Can't connect to MySQL with PDO

后端 未结 2 855
失恋的感觉
失恋的感觉 2021-01-16 06:23

I\'m following this tutorial, I\'m currently around minute 04:00 and I want to make a connection with my MySQL database through PDO. But my webpage will always give \"Could

2条回答
  •  暖寄归人
    2021-01-16 07:08

    You have error in code near localhost

    Use semicolon in place of colon

    Write this instead:

    $pdo=new PDO('mysql:host=localhost;dbname=mytodo','root','');
    

提交回复
热议问题