2
My webservice is returning an error that I haven’t been able to resolve yet.
Follows the code:
`<?php
$dns = ‘mysql:host=localhost;dbname=diagnosys_db’;
$user = ‘user_name’;
$password = ‘user_password’;
try{
$db = new PDO ($dns, $user, $pass);
}
catch( PDOException $e){
$error = $e->getMessage();
echo $error;
}
?>`
The error returned is as follows:
Parse error: syntax error, Unexpected ':' in /Storage/ssd4/128/11623128/public_html/db.php on line 2
You have declared a variable called $password, but when you are instantiating the PDO is using a variable called $pass, try replacing $pass with $password
– Raphael Godoi
Already analyzed the types of quotes you are using? in that reply you find a quick explanation about errors caused by quotation marks.
– RXSD