PHP Tutorial (& MySQL) #26 - Getting Data From a Database

Hey all, in this PHP tutorial I'll show you how we can use SQL to select (get) some data from a database.
----------------------------------------
🐱‍💻 🐱‍💻 Course Links:
+ Course files - github.com/iamshaunjp/php-mys...
+ VS Code editor - code.visualstudio.com/
+ Materialize Playlist - • Materialize Tutorial #...
🤑🤑 Donate
+ www.paypal.me/thenetninja
🎓🎓 Find me on Udemy
+ www.udemy.com/user/47fd83f6-5...

Пікірлер: 109

  • @fahrifoxtrot-whiskey9242
    @fahrifoxtrot-whiskey92425 жыл бұрын

    I cannot believe this! You kidding! Tutorial 25 and this one together would save my hours if I could seen them before! None could tell this so simple and explain that easy! I don't know what to say. :) It wasn't like building a spaceship at the end. Very warm thanks, Shaun.

  • @shannonstumpf1861
    @shannonstumpf1861 Жыл бұрын

    You explain everything and never miss a detail. I'm always scratching my head and asking more questions with other tutorials. This is genius. Thank you

  • @HarshDave009
    @HarshDave0092 жыл бұрын

    Your videos are an escape from tutorial hell! Thanks so much. Your videos are so concise, and everything that someone needs is right here. These tutorials I actually don't mind binging.

  • @D4ggity
    @D4ggity3 жыл бұрын

    Coming in from a PHP class with NO learning materials, this is a life saver!

  • @TheBen465
    @TheBen4654 жыл бұрын

    Honestly man, fucking wow. A1 tutorials walked me through every step of the way, nothing overlooked like the rest of these tutorials and I dont have to be thrown out to the web to scour for answers. So refreshing to have a young tutor who has evidently gone through the same bullshit as everyone learning who can give such a good insight into how to code.

  • @NetNinja

    @NetNinja

    4 жыл бұрын

    Thanks Ben :)

  • @user-ct5oo3do7b

    @user-ct5oo3do7b

    3 жыл бұрын

    No cussing!!!

  • @fabriziogallici7118
    @fabriziogallici71184 жыл бұрын

    i'm a pizza maker and hopefully a future programmer, so this is perfect for me.

  • @yeeeeetcode

    @yeeeeetcode

    3 жыл бұрын

    GOODLUCK!

  • @rubenverster250

    @rubenverster250

    3 жыл бұрын

    You junior dev yet?

  • @iamdmonz
    @iamdmonz4 жыл бұрын

    Again you are the best teacher ever, easy to understand ... thank you < 3

  • @rtagliavia89
    @rtagliavia895 жыл бұрын

    hi, im new in your channel, and i love your tutorials, I'm very happy to have found this channel. :D thank you

  • @centrumsaiyan7623
    @centrumsaiyan76232 жыл бұрын

    I am 2 years experienced JavaScript developer. Find your course to be easily understood and my brain is absorbing the concept so well. Thanks Shaun. You are my number 1 KZread channel when it comes to video tutorial.

  • @NetNinja

    @NetNinja

    2 жыл бұрын

    Thanks for the kind words! :) glad to help.

  • @richardrodgers7406
    @richardrodgers74062 жыл бұрын

    Very detailed tutorial. Thanks for the content!

  • @amashhassan8959
    @amashhassan89592 жыл бұрын

    i have coursework due in one hour and you just saved my life man

  • @montecristo7963
    @montecristo79632 жыл бұрын

    Such a great teacher, thank you for making this videos .

  • @eminem3055
    @eminem30552 жыл бұрын

    thank you so much, i finally found someone how explain the steps not just read the code that he wrote.

  • @yassineelgorfti
    @yassineelgorfti3 жыл бұрын

    A special thanks to you from Morocco, you did good God bless you

  • @consoledoterror971
    @consoledoterror9714 жыл бұрын

    I loved this video. And subbed. THANK YOU SHAUN.

  • @NetNinja

    @NetNinja

    4 жыл бұрын

    Thank you :)

  • @abrar8133
    @abrar81333 жыл бұрын

    You're the best! I'm happy that my fav channel has covered PHP course. Please make Laravel course

  • @kingtyphoon
    @kingtyphoon Жыл бұрын

    This is just great and clear!

  • @alexhaussmann2078
    @alexhaussmann20785 жыл бұрын

    You saved me many hours thank you

  • @Danieloss98
    @Danieloss98 Жыл бұрын

    Great! Simple and straight to the point!

  • @NetNinja

    @NetNinja

    Жыл бұрын

    Thanks Deroxon, appreciate it :)

  • @laurentchevrette9934
    @laurentchevrette99342 жыл бұрын

    Amazing, that finally helped!

  • @bastaty8241
    @bastaty82413 жыл бұрын

    You're such an amazing instructor I ever seen ... thank you so much for all stuff you've done kindly what do you suggest to do after this course ?

  • @atishmhatre4895
    @atishmhatre48955 жыл бұрын

    very nice Tutorial, Thank you so much Shaun!

  • @justinherrera6790
    @justinherrera67905 жыл бұрын

    doing this in mysqli OO would be the best. Thank you

  • @Lyrik-Klinge
    @Lyrik-Klinge Жыл бұрын

    Great!

  • @rajdhanani5500
    @rajdhanani55005 жыл бұрын

    Awesome👌👌 Can u plz put some light on stored procedures ... It would be really helpful...

  • @bacikulile
    @bacikulile4 жыл бұрын

    hey , what do i do if my xampp doesn't have a user tab or privileges tab

  • @AshexX
    @AshexX2 жыл бұрын

    First of all, thank you for the simple and well explained tutorial. Second, are you using some kind of custom font? The text on this video just look so good to me! I even full-screened the video and the text just looks better (with less jagged edges) than the text I normally see on my computer. What is your secret Net Ninja!

  • @SagarNamye
    @SagarNamye2 жыл бұрын

    Hey @the net ninja, how to resolve mysqli_fetch_all() expects parameter 1 to be mysqli_result, error? Please help

  • @SuperSayiyajin
    @SuperSayiyajin4 жыл бұрын

    Thanks a lot...

  • @nikosalamini7657
    @nikosalamini76575 жыл бұрын

    Hi ninja, i have a doubt about the usage of mysqli_fetch_all. What do you mean when you say "get the data in a format than we can use"? Is it correct to use the $result variable for doing some simple things? Like a foreach cycle to control if a user and pass is present in the db. Something like this: foreach($result as $Acc){ if($Acc["Username"]==$username && $Acc["Password"]==$password){ echo 'Successful'; break 1; } } Acc stands for account. Thanks for all the stuff that you provide!

  • @bluecrystal96
    @bluecrystal964 жыл бұрын

    I typed everything correct, now I'm as I refresh, I get an error saying 'failed to load resource, localhost is currently unable to handle this request'.....

  • @bikramchettri9405
    @bikramchettri94055 жыл бұрын

    Thanks for the tutorial.

  • @user-it1zo8sl2z
    @user-it1zo8sl2z2 жыл бұрын

    Hello, I have tried to connect to the database with mysqli_connect but it says to me Error: Class 'mysqli_connect' not found in please help me thanks in advancce

  • @sunewakoandaleoba297
    @sunewakoandaleoba2973 жыл бұрын

    I am getting this error- Warning: mysqli_fetch_all() expects parameter 2 to be long, string given in C:\xampp\htdocs\PHPMySQL\index.php on line 16 How do I resolve that?

  • @sardarali2401
    @sardarali24012 жыл бұрын

    Warning: mysqli_fetch_all() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\first php\index.php on line 16 iam stuck in error how i can resolve it plz help me

  • @chukwuebukaaneke7314
    @chukwuebukaaneke73145 жыл бұрын

    Thanks shaun!

  • @ya4781
    @ya47813 жыл бұрын

    The tutorial is really good and useful!! But having it in Pizza example is making it hard ;(

  • @AlexandarKaravelov
    @AlexandarKaravelov3 жыл бұрын

    Hey nice Tutorial. It worked perfectly, but i need the result to be Integer or string. Because i get that: Array ( [0] => 1 ) and i really only need the 1 that is coming out. Can you help me with that?

  • @AlexandarKaravelov

    @AlexandarKaravelov

    3 жыл бұрын

    Nvm i solved it. Instead of print_r i did :echo "" . array_sum($OnlinePlayers) . " "; Which i think basicly means that it is giving me the sum in the array. :)

  • @ryanudatinya6253
    @ryanudatinya62534 жыл бұрын

    Warning: mysqli_fetch_all() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\class\index.php on line 16 what should I do

  • @nayem5137

    @nayem5137

    3 жыл бұрын

    make sure you don't have any typo

  • @perianka
    @perianka4 жыл бұрын

    what's the difference between mysqli_connect and try { $pdo = new PDO ('mysql: host=127.0.0.1;dbname=mytodo,root,""') } catch (PDOException $e) { die ($e -> getMessage()); }

  • @mohammadahmermalick7869
    @mohammadahmermalick78694 жыл бұрын

    echo ''; print_r($variable); echo ''; this will print in a better way your videos are great

  • @akdworld9284

    @akdworld9284

    4 жыл бұрын

    cool!

  • @despotjc3144
    @despotjc31443 жыл бұрын

    Fatal error: Uncaught TypeError: mysqli_fetch_all(): Argument #1 ($result) must be of type mysqli_result, bool given in Xamp is newest .

  • @dougiehawes916

    @dougiehawes916

    2 жыл бұрын

    I ran into the same issue and have found things to work after I removed "ORDER BY created_at" from the $sql string. Turned out I spelled it 'create_at'. Might not be your issues, just pointing you in the right direction.

  • @skrumb
    @skrumb3 жыл бұрын

    *SCOTLAND FOREEEEEEEVVVVVVVEEEEEEERRRRRR!*

  • @arunhembram1859
    @arunhembram18594 жыл бұрын

    Uncaught Error: Call to undefined function mysql_query()

  • @cdabiggy

    @cdabiggy

    2 жыл бұрын

    It's mysqli_query(). You forgot the i in mysqli.

  • @stephenburke9909
    @stephenburke99094 жыл бұрын

    Hey Ninja, I have an issue. I see in the comments below I am not the only one who has stumbled here. Maybe some clarification or work around would be of value? This does not work when I upload to my godaddy account: $row = mysqli_fetch_all($result, MYSQLI_ASSOC); My current work around so I can continue the project is to use 'array' instead of 'all' $row = mysqli_fetch_array($result, MYSQLI_ASSOC); But this only returns the first row in the database. Weirdly enough though, it comes out 3 times on my page? Anyway I tried a few different loops to cycle through but I was unsuccessful. Any idea what I can do to get around this and continue on? Thank you

  • @JunaidAnsari-yu5gl

    @JunaidAnsari-yu5gl

    4 жыл бұрын

    USE THIS INSTEAD OF THE YOUR CODE $rows= mysqli_fetch_assoc($result);

  • @adam.crawford_2709

    @adam.crawford_2709

    4 жыл бұрын

    @@JunaidAnsari-yu5gl his doesnt work

  • @Hiiaamm
    @Hiiaamm3 жыл бұрын

    I'm getting 3 errors not sure why

  • @muktadirulislam9537
    @muktadirulislam95375 жыл бұрын

    Can u prepare tutorials on how to connect django, vuetify/vue? Thanks in advance.

  • @coolwaterdvr
    @coolwaterdvr3 жыл бұрын

    👍👍👍👍👍

  • @fabiiic-ops8600
    @fabiiic-ops86004 жыл бұрын

    Soo guys If you get the error "mysqli_fetch_array() expects parameter 1" try putting this $result = mysqli_query($conn, $sql) or die("Error: ".mysqli_error($conn)); This may slove your problem :)

  • @zaytuls

    @zaytuls

    4 жыл бұрын

    Didn't work.

  • @aksharpatel17

    @aksharpatel17

    4 жыл бұрын

    Worked thanks

  • @Sam-hd3ks

    @Sam-hd3ks

    2 жыл бұрын

    didn't work

  • @SolidityEth
    @SolidityEth2 жыл бұрын

    Liked

  • @SolidityEth

    @SolidityEth

    2 жыл бұрын

    jk, you using PHP

  • @SolidityEth

    @SolidityEth

    2 жыл бұрын

    and please avoid typing pizza, unless you're italian

  • @SolidityEth

    @SolidityEth

    2 жыл бұрын

    but you're not

  • @SolidityEth

    @SolidityEth

    2 жыл бұрын

    so

  • @SolidityEth

    @SolidityEth

    2 жыл бұрын

    PHP sucks

  • @SavageScientist
    @SavageScientist4 жыл бұрын

    Things changed with PHP 7 these functions no longer work

  • @blvksmithtradingchannel2883

    @blvksmithtradingchannel2883

    4 жыл бұрын

    so how do i figure out the updated php

  • @SavageScientist

    @SavageScientist

    4 жыл бұрын

    www.php.net/manual/en/book.mysqli.php

  • @himari5691
    @himari56914 жыл бұрын

    Warning: mysqli_fetch_all() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\tuts\index.php on line 18 Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\tuts\index.php on line 21 I get this warning, how do I solve it?

  • @lucasferreira8229

    @lucasferreira8229

    Жыл бұрын

    I got the same, did you solve it?

  • @MustafaBirsoz
    @MustafaBirsoz4 жыл бұрын

  • @mailjjbjb884
    @mailjjbjb8844 жыл бұрын

    SQAEUK

  • @martinsb6474
    @martinsb6474 Жыл бұрын

    If anyone got the code stop running at $pizzas = mysqli_fetch_all($result, MYSQLI_ASSOC); I discovered how to solve this. Basically, if you are running this .php on a server, I DON'T RECOMMEND using mysqli_fetch_all function because it won't work in older php versions, and most importantly, it needs mysqlnd installed (which I don't even know what is). To solve the issue I replaced: $pizzas = mysqli_fetch_all($result, MYSQLI_ASSOC); By: $rows = mysqli_num_rows($result); while ($rows = mysqli_fetch_assoc($result)) { $pizzas[] = $rows; } Then, the print_r($pizzas); function should work normally.