我已经尝试过$ row [0]而不是$ row [1]。它说,像这样的“通知:未定义抵消:1在C:\ XAMPP \ htdocs中\上线10 t2.php”Php数组的偏移量
<?php
$c=mysql_connect("localhost","root","");
//db connection
mysql_select_db("niro");
$re=mysql_query("select id from detail where grade >=80 ORDER BY RAND()");
//select who are all have above 80
while($x=mysql_fetch_array($re, MYSQL_BOTH))
{
printf ("%s %s",$x[0],$x[1]."\n");
// i have multiple fields but it says undefined offset : 1.
}
?>
'print_r($ x);'循环内 – 2016-03-03 03:43:16
尝试选择全部而不是选择ID列。 – claudios
Gothca claudios :)但我该如何选择2列与单列 –