-1
在我的代码中while while循环打印两次输出。这是我的PHP代码:while循环打印两次输出
if($con)
{
echo '<h1>Connected to MySQL</h1>';
$sql = 'select age, salary from emp';
mysql_select_db('toor');
$retval = mysql_query($sql, $con);
if(!$retval)
die('could not get data'.mysql_error());
while($row = mysql_fetch_array($retval, MYSQL_NUM))
{
echo "age:{$row[0]}<br>"."sal:{$row[1]}<br>";
}
}
删除
$con
请考虑停止使用mysql_ *功能,因为这扩展不支持任何越来越从最新的PHP版本中删除。使用它可能会导致您的产品存在安全漏洞。 –