PHP MySQL Tutorial

Get the Code Here :

PHP Tutorial :

MySQL Tutorial :

Support Me on Patreon :

Previously I covered the vast majority of both PHP and MySQL in 2 videos. This time I decided to bridge the gap and show how to simply grab data from and edit data in a MySQL database using PHP.

We specifically cover creating users with limited access for security reasons, setting up secure database connections, pulling data from a database, adding data to the database and prepared statements.


El Mehdi DOUAZOU says:

Been on youtube for years, and never felt the need to comment anything..
Just to say how much i’m thankful to you and your work.
I love the way you make every coding language basics seem so simple.
Great job and thank you again !

Mehmed Bazdar says:

The scope methodology is different in PHP than in some other languages. It looks like you can access variables even if they are not in the same scope. Is that right ?

john doe says:

EXCELLENT tutorial!!!

Sonny corido says:

I am newbie in php and this tutorial is very good :).. however I tried to used your code in the link you have provided in comment but I have experienced an error which is the reason why I can’t run the code correctly, can tell me why is this not working.

I am using xampp, I created directory for this files and the error that I’ve encountered are this:
Couldn’t issue database query
Table ‘test3.students’ doesn’t exist


Sergey Semashko says:

2:28 – 15:17 (пропустил кусок). No SQL

Rasmus Sikk says:

When try to add new student, i fill up the caps i need to, then press send button, and it clears all data i had entered. Then i go to getstudentinfo page, and there is no added student i just tried to add.

Also in file added student, mysqli_stmt_bind_param($stmt, “ssssssisssd”, $f_name, $l_name … ) it only allowe me to give 3 arguments. Can any1 help?

Federico Pettinicchio says:

Have you ever considered talking slower? not by much, a pause here and there, just enough so that it doesn’t feel like you are trying to make time but to get the point across.

Greg Herrick says:

Hey Derek…Thanks a lot for a great overview.

haris ramzan says:


Surya Gaming says:

is this in wamp or xampp server?

Ananda Wisely says:

You are awesome, Derek Banas. 🙂


great tutorials

Gregory Floirendo says:

nice tutorial, but can you please create another one for an updated version? thanks!

David M. says:

este video es una mierda

edaWsknaB Music says:

Thanks a lot for your teaching this

Kris Staples says:

interesting video thank you.

Daniel K says:

Awesome videos !!!! Keep them coming ! 🙂

Jeremy Sur says:

Does anyone know how to adjust the getstudentinfo.php to only show the last information in the array?

Saurabh Swarnakar says:

Thank you so much!! Derek your videos are so helpful, you made the boring books contents into some interactive videos which makes me learn languages in no time.
Stay blessed and keep up the good work…

Lokre Sainath Rao says:

After clicking on Send, i got these warnings

Notice: Undefined variable: dbc in D:XAMMPhtdocsexamplestudentadded.php on line 98

Warning: mysqli_prepare() expects parameter 1 to be mysqli, null given in D:XAMMPhtdocsexamplestudentadded.php on line 98

Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, null given in D:XAMMPhtdocsexamplestudentadded.php on line 100

Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, null given in D:XAMMPhtdocsexamplestudentadded.php on line 102

Warning: mysqli_stmt_affected_rows() expects parameter 1 to be mysqli_stmt, null given in D:XAMMPhtdocsexamplestudentadded.php on line 104
Error Occureed

Warning: mysqli_error() expects exactly 1 parameter, 0 given in D:XAMMPhtdocsexamplestudentadded.php on line 116

Erich Macher says:

Great Job! Thanks.

Youssef Samwel says:

Derek, what is the difference between mysql vs mysqli

Rafat Yusufi says:



I== !understand.

Huo Liquidh says:

Hi Derek, any idea how to link database info to 3rd party websites that are not controlled by you? Such that the various fields (e.g. name, age, sex, etc) are automatically filled in at the click of a button (or two). Something like what Fillr does.

Nric Posada says:

Thank You! Derek! real life saver!

buddyroach says:

can you make a tutorial on mysql security and the best ways to prevent mysql code injections?


I love your style and the fluency is topnotch.

Nelson Beimfohr says:

Awesome Tutorial. Giving you credit for a school project!

Janek Liberowski says:

super tutorial thank you so much Derek!!

shepherd maepa says:

what is that text editor you are using?

Aran Taylor says:

When I try to open the “getstudentinfo.php” file through localhost, I keep getting the 404 error.. PLEASE HELP! D:

Ivan Ramirez says:

Maybe I missed something but what exactly is the PHP command to establishes the connection between PHP and MySQL? In Minute 4:30 you define variable ‘dbc ‘ and you use the ‘mysqli_connect’ function. Is that a native PHP function that establishes connections to any DB? What if my DB is not MySQL but something else, will this still work? Thank you!

Chen Min says:

It is very useful for me ,thanks a lot!

tihaseautod says:

If you really wanna be sure of security then use prepared statements, but this works also.

Douglas Augusto Rezende Dias says:

To get this working on my offline laptop only, do I need any software other than note pad ? If yes, which ones ? Thanks a lot !!

Levi Gonzales says:

I love the videos for quick emerson into a topic that I’m looking to get into. They’re also short enough to get a quick refresher on something.

Ridwan Nana-Yaw Amoako says:

hello derek I have all my php files working without any errors but no record shows in mysql table after completing and submitting the form. Ive checked online for possible reasons but to no avail. any suggestions for me?

Gaming With jhawkes says:

Derek, You deserve 1,000,000 subs dude!!!!!

leonardo Saravia says:

Man… thanks… for real haha, can’t bealive how fast I’ve learn PHP and Mysql haha, great tutorials for ppl looking to migrate to another lenguaje. keep it up!

Ashutosh Mehta says:

Awesome thank you

ImreKutňas says:

Nice man! Thanks a lot!

Lasers, HV, and more says:

Derek, thank you for your excellent tutorials.
I need an online database – in other words, a
database that ‘lives’ on my website server (instead of my local computer) so that other
people can log in to view, submit, or remove data. Is there a
way to accomplish this?


loxiuras Itz says:

I get ‘mysqli_stmt’ errors ;(

AlmaGrebiᴴᴰ says:

PLZ One Video in #PHP_For_Wordpress TNK’s

winking962 says:

very helpful ,thx man!

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!