<?php foreach($rows as $row):?> 报错 $rows 无效参数是什么情况呢?
<?php
$mysqli=new mysqli('127.0.0.1','root','root','usercms');
if($mysqli->connect_errno){
die('CONNECT ERROR:'.$mysqli->connect_error);
}
$sql="select ad_id,username,password from usercms";
$mysqli_result=$mysqli->query($sql);
if($mysqli_result && $mysqli_result->num_rows>0){
while($row = $mysqli_result->fetch_assoc()){
$rows[]=$row;
}
}
//print_r($rowsr);
?>
一直报错 并且 数据表的内容打不出来,是哪里错了呢 ??
Notice: Undefined variable: rows in D:\myenv\apache\htdocs\newpro\login.php on line 28
Warning: Invalid argument supplied for foreach() in D:\myenv\apache\htdocs\newpro\login.php on line 28