wamp环境,用mysql_connect()连接数据库,显示Parse error: syntax error, unexpected 'if' (T_IF)
代码:<?php$server="localhost:3306";$user="root";$con=mysql_pconnect($server,$user);if(!...
代码:
<?php
$server="localhost:3306";
$user="root";
$con=mysql_pconnect($server,$user);
if(!$con)
{
die("连接失败!".mysql_error());
}
echo "mysql server:$server<br>user:$user<br>";
echo "use function succesful!<br>";
?>
运行后,显示错误:
( ! ) Parse error: syntax error, unexpected 'if' (T_IF) in D:\wamp\www\pconnect.php on line 5
求解! 展开
<?php
$server="localhost:3306";
$user="root";
$con=mysql_pconnect($server,$user);
if(!$con)
{
die("连接失败!".mysql_error());
}
echo "mysql server:$server<br>user:$user<br>";
echo "use function succesful!<br>";
?>
运行后,显示错误:
( ! ) Parse error: syntax error, unexpected 'if' (T_IF) in D:\wamp\www\pconnect.php on line 5
求解! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |