嗨,这是我的代码,我无法弄清楚什么是错的?
<?PHP
$my_connection = mysql_connect('localhost', 'root', 'password');
for (!$my_connection){
die("Could not connect" . mysql_error());
}
echo "Conected sucessfully" . "<br>";
mysql_select_db('killer');
mysql_close($my_connection);
?>
答案 0 :(得分:5)
修订后的代码
<?php
$my_connection = mysql_connect('localhost', 'root', 'password');
if (!$my_connection)
die("Could not connect" . mysql_error());
echo "Conected sucessfully <br/>";
mysql_select_db('killer');
mysql_close($my_connection);
?>
答案 1 :(得分:4)
将for
替换为if
,应该这样做