Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Carl Taylor
Carl Taylor
21,308 Points

PHP CONNECT TO SQL NOT SQLITE

Hi I am currently working on a login functionality for my portfolio.

Yet I really want to learn how to connect to connect PHP to MySQL not MySQL Lite.

Is there any video that I can follow here?

Thanks :)

Hey Carl, I don't think there is any video for mysql connection but it's simple to do

  try{
  $db = new PDO("mysql:host=localhost;dbname=databasename;port=3306","username","password");
}catch(Exception $e){
  echo $e->getMessage();
}

//username and password for your localhost by default is root 

If you still have some dought check out these https://www.youtube.com/watch?v=QtCdk459NFg&list=PLfdtiltiRHWHkDwEoZ29Q9FKtWVjA46HC awesome tutorials by Alex.