douqin231881 2013-12-26 22:40
浏览 22
已采纳

虽然一切正确但PHP语法错误? [关闭]

Im not sure why am I getting this syntax error.

Parse error: syntax error, unexpected '{' in /var/www/test/db.php on line 13

The code seems fine to me... Can anyone give me a few tips? :)

$server = 'host';
$username   = 'username';
$password   = 'password';
$database   = 'database';

if(!mysql_connect($server, $username,  $password))
{
    exit('Error: could not establish database connection');
}

if(!mysql_select_db($database)
{
    exit('Error: could not select the database');
}
  • 写回答

7条回答 默认 最新

  • douwu5428 2013-12-26 22:42
    关注

    Is missing a close parenthesis

    if(!mysql_select_db($database) )
                                   ^---Missing
    {
    exit('Error: could not select the database');
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(6条)

报告相同问题?