0

I'm trying to establish a new PDO instance with the following code

<?php
$handler = new PDO(“mysql:host=127.0.0.1;dbname=database”,
“root”, “”);

I get the following error message:

Parse error: syntax error, unexpected ':', expecting ',' or ')' in /Applications/XAMPP/xamppfiles/htdocs/example/connection.php on line 2

There has been no problems like this before until I attempted to do this on a new Mac. Can someone help with this issue?

Josh
  • 101
  • 2
  • 9
  • 9
    all of those curly quotes need to be straightened `“` should be `"` – Samuel Cook Aug 01 '17 at 18:50
  • 1
    Looks like you're not typing in a proper editor. You shouldn't type in standard programs like Word or the likes, they aren't suitable for that. – Qirel Aug 01 '17 at 18:54
  • Possible duplicate of [Double quotes are not copied normally. How can I edit them?](https://stackoverflow.com/questions/14303353/double-quotes-are-not-copied-normally-how-can-i-edit-them) – Don't Panic Aug 01 '17 at 19:33

2 Answers2

0

try this:

$handler = new PDO("mysql:host=127.0.0.1;dbname=database",
"root", "");

your quotes were wrong

David Jones
  • 4,275
  • 6
  • 27
  • 51
Zafi
  • 16
  • 1
0

You should to this:

<?php
$handler = new PDO("mysql:host=127.0.0.1;dbname=database","root", "");
German
  • 1,449
  • 12
  • 13