Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine

Course 3: Talking to a MySQL Database in PHP

45:36

What you'll be learning

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:


Your Guides

Ryan Weaver Leanna Pelham

Buy Access

Join the Conversation?

10
Login or Register to join the conversation
Neal O. Avatar
Neal O. Avatar Neal O. | posted 5 years ago

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.

1 Reply

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!

Reply
Default user avatar
Default user avatar Gilron Charles | weaverryan | posted 5 years ago

I would really love to see an episode 4 also

Reply
Default user avatar
Default user avatar Anne Bonham | posted 5 years ago

Love the series, thanks! Can't wait to learn how to connect the form submissions to the db!

1 Reply
Wahyu A. Avatar
Wahyu A. Avatar Wahyu A. | posted 2 years ago

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

Reply

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!

Reply
Default user avatar
Default user avatar Euclides Cohen | posted 5 years ago

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:

http://imgur.com/V5qpKfl

Reply

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!

Reply
Default user avatar
Default user avatar Euclides Cohen | Victor | posted 5 years ago

Hey Victor, thanks for replying. I had to inspect the source code.

Can you use the VarDumper Component on non Symfony projects?

Reply

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!

Reply
Cat in space

"Houston: no signs of life"
Start the conversation!

userVoice