每次我尝试使用 php 连接到数据库时,我都会不断收到此错误:Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /homepages/12/d441172468/htdocs/Organizer/dashboard/index.php on line 258
如何解决此问题?我的代码是
$email = 'redacted@me.com_classes';
echo $email;
$result = mysqli_query($con,"SELECT * FROM $email");
$classcount = 1;
while($row = mysqli_fetch_array($result))
{
$period = $row['period'];
$teacher = $row['teacher'];
$subject = $row['subject'];
$subjecto = strtolower($subject);
$subjecto = str_replace(' ', '', $subjecto);
$grade = $row['grade'];
echo "<li id='button" . $classcount . "' onclick='" . $subjecto . "(),homework" . $classcount . "()'>" . $classcount . ". " . $subject . "-" . $grade . "</li>\n";
$classcount += 1;
}
当我回显它时,该$email
变量工作正常。第128行是while($row = mysqli_fetch_array($result))
部分