Course 3: Talking to a MySQL Database in PHP
Dive into MySQL databases: from connection, creation, queries to security, all in PHP.
About this course
Woh, this is episode 3 of our Epic PHP series!
Yep, and this one is all about databases:
- What the heck is a database anyways?
- Connecting to MySQL
- Creating a database and tables
- INSERT queries
- SELECT queries
- UPDATE and DELETE queries
- Using PDO in PHP to run queries
- Limiting Results
- Avoiding SQL Injection Attacks
- Prepared Statements
- Optional Function Arguments
Other episodes from this series:
Next courses in the PHP: Get Started section of the PHP Track!
10 Comments
Hey Neal!
Yes, we have a lot of threads going :). I promise we'll be looking more into this series to make sure it's complete. And thanks for the nice words - I want people to be able to go from zero to hero all in one place. The specifics for ep4 aren't planned yet - but I just added your suggestions to our planning document.
Thanks!
Love the series, thanks! Can't wait to learn how to connect the form submissions to the db!
How can i complete this course ? I have watched it all but it still "You're through this course
complete - get started!" there is not any challenge yet
Hey Wahyu,
Are you logged in to your account? If so, please, look at the list of chapters - there should be a "tick" icon on every chapter title in the list. Find those that do not have ticks and watch the video til the end. If you still have this problem - please, write to us via our contact form: https://symfonycasts.com/co... and we will look at your account and give you some tips what else you have to do to finish the course 100%.
Cheers!
Hey guys, I am very happy to be back to Knp University. One question: Is there a way to clean up the output of my database array, mine looks horrible (one line)? Take a look to this screenshot to see what I mean:
Hey, Euclides!
Yes, it's totally unreadable! The easiest way is to open Source Code in your browser (command+option+U on Mac). The output will be preformatted vertically.
If you want something more cool, you need to install xDebug. This is a PHP extension, which you can install from your package manager ( like APT-GET on Ubuntu). After you install and enable it, your var_dump output will look much pretty. But keep in mind, that xDebug a bit reduce page performance, maybe it's not you want to be installed on production but only in development.
You could also check the coolest Symfony's VarDumper Component which does not required any PHP extension and has a nice output with ability to expand nested nodes.
And let me know what you chose! :)
Cheers!
Hey Victor, thanks for replying. I had to inspect the source code.
Can you use the VarDumper Component on non Symfony projects?
Yes, it's a standalone component, which required only PHP 5.5.9 or newer and a small "symfony/polyfill-mbstring" package which is just a polyfill for the Mbstring PHP extension. So you can use it in any PHP project!
BTW, If you want to use it in Symfony projects, better use a DebugBundle instead, it's a bundle for varDumper component which already has integrations for WebDebugToolbar and Twig. But Symfony 3 already has it out-of-the-box, you can just use it from the start.
Cheers!
Is there going to be a 4 episode for the PHP series that covers inserting, updating and deleting data? Your tutorials are the best I have found on the web but several seem to be stuck in limbo with lots of unfinished sections. I would challenge you to look at all the available tutorials and finish them before throwing out more Symfony 3 stuff. Probably could be accomplished in a months time. Looking forward to a productive new year learning with KnpUniversity.