尝试在php中从mysql中的表中打印值,但它没有显示任何内容
$connect = mysql_connect("127.0.0.1","root","1234567");
$db = mysql_select_db("skynet");
$query = mysql_query("SELECT * FROM users");
while($rows = mysql_fetch_array($query)){
$name = $rows['$name'];
$mail = $rows['$mail'];
echo $name;
echo $mail;
}
答案 0 :(得分:2)
$ name和$ mail没有值,并且被用作$ row索引,删除$行[$ xxx]的$。
$name = $rows['$name'];
$mail = $rows['$mail'];
从$ row [$ xxx]的括号内删除$。
$name = $rows['name'];
$mail = $rows['mail'];