I just uploadd a site I amworking on, but get the following error:
Parse error: syntax error, unexpected ‘{’ in c:\domains\yoursite.nl\wwwroot\includes\connect.php on line 3
Not just in the normal templates but in the connection file as well, which look like this:
<?php
try
{
$pdo = new PDO('mysql:host=localhost;dbname=db_name',
'$user',
'$pass');
}
catch (PDOException $e)
{
echo 'Er is een database fout opgetreden.';
exit();
}
?>
Offline it is working fine this way.
There’s nothing obvious there. I tried the code here on my localhost and it worked fine. Does it work OK if you just have the above code as a PHP file and call it up?
Off-the-wall suggestion … make the $pdo declaration as a single line. Perhaps there’s some config setting on your online server that doesn’t like that coding structure?