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
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.
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
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.
Coming in from a PHP class with NO learning materials, this is a life saver!
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
4 жыл бұрын
Thanks Ben :)
@user-ct5oo3do7b
3 жыл бұрын
No cussing!!!
i'm a pizza maker and hopefully a future programmer, so this is perfect for me.
@yeeeeetcode
3 жыл бұрын
GOODLUCK!
@rubenverster250
3 жыл бұрын
You junior dev yet?
Again you are the best teacher ever, easy to understand ... thank you < 3
hi, im new in your channel, and i love your tutorials, I'm very happy to have found this channel. :D thank you
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
2 жыл бұрын
Thanks for the kind words! :) glad to help.
Very detailed tutorial. Thanks for the content!
i have coursework due in one hour and you just saved my life man
Such a great teacher, thank you for making this videos .
thank you so much, i finally found someone how explain the steps not just read the code that he wrote.
A special thanks to you from Morocco, you did good God bless you
I loved this video. And subbed. THANK YOU SHAUN.
@NetNinja
4 жыл бұрын
Thank you :)
You're the best! I'm happy that my fav channel has covered PHP course. Please make Laravel course
This is just great and clear!
You saved me many hours thank you
Great! Simple and straight to the point!
@NetNinja
Жыл бұрын
Thanks Deroxon, appreciate it :)
Amazing, that finally helped!
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 ?
very nice Tutorial, Thank you so much Shaun!
doing this in mysqli OO would be the best. Thank you
Great!
Awesome👌👌 Can u plz put some light on stored procedures ... It would be really helpful...
hey , what do i do if my xampp doesn't have a user tab or privileges tab
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!
Hey @the net ninja, how to resolve mysqli_fetch_all() expects parameter 1 to be mysqli_result, error? Please help
Thanks a lot...
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!
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'.....
Thanks for the tutorial.
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
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?
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
Thanks shaun!
The tutorial is really good and useful!! But having it in Pizza example is making it hard ;(
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
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. :)
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
3 жыл бұрын
make sure you don't have any typo
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()); }
echo ''; print_r($variable); echo ''; this will print in a better way your videos are great
@akdworld9284
4 жыл бұрын
cool!
Fatal error: Uncaught TypeError: mysqli_fetch_all(): Argument #1 ($result) must be of type mysqli_result, bool given in Xamp is newest .
@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.
*SCOTLAND FOREEEEEEEVVVVVVVEEEEEEERRRRRR!*
Uncaught Error: Call to undefined function mysql_query()
@cdabiggy
2 жыл бұрын
It's mysqli_query(). You forgot the i in mysqli.
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
4 жыл бұрын
USE THIS INSTEAD OF THE YOUR CODE $rows= mysqli_fetch_assoc($result);
@adam.crawford_2709
4 жыл бұрын
@@JunaidAnsari-yu5gl his doesnt work
I'm getting 3 errors not sure why
Can u prepare tutorials on how to connect django, vuetify/vue? Thanks in advance.
👍👍👍👍👍
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
4 жыл бұрын
Didn't work.
@aksharpatel17
4 жыл бұрын
Worked thanks
@Sam-hd3ks
2 жыл бұрын
didn't work
Liked
@SolidityEth
2 жыл бұрын
jk, you using PHP
@SolidityEth
2 жыл бұрын
and please avoid typing pizza, unless you're italian
@SolidityEth
2 жыл бұрын
but you're not
@SolidityEth
2 жыл бұрын
so
@SolidityEth
2 жыл бұрын
PHP sucks
Things changed with PHP 7 these functions no longer work
@blvksmithtradingchannel2883
4 жыл бұрын
so how do i figure out the updated php
@SavageScientist
4 жыл бұрын
www.php.net/manual/en/book.mysqli.php
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
Жыл бұрын
I got the same, did you solve it?
SQAEUK
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.