<?php
$username = 'Gianna';
$con = mysqli_connect("$db_host","$db_username","$db_pass","$db_name");
if (!$con){die('Could not connect: ' .mysql_error());}
$result = mysqli_query($con,"SELECT * FROM $s_table WHERE stName='$username'");
while ($row = mysqli_fetch_array($result)){
$data1 = "instructor=";
$data2 = $data1."'".$row['insName']."'".",";
$trimmed = rtrim($data2, ",");}
mysqli_close($con);
?>
我已经在许多其他脚本中成功运行了它,但由于某种原因它不断返回PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given on line 56
第 56 行是while
循环。