正如标题所示,尝试在PHP中执行SQL查询时,我收到一个“警告:mysqli_fetch_array()期望参数1为mysqli_result,..中给出的布尔值。”错误。
我的代码如下:
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
else{
$sessionusername = $_SESSION["username"];
$query = mysqli_query($conn,"SELECT * FROM APPOINTMENT WHERE username = $sessionusername");
while($row = mysqli_fetch_array($query))
{
echo "<tr>";
echo "<td class= 'inside-while'>" . $row['APNo'] . "</td>";
echo "<td class= 'inside-while'>" . $row['DNo'] . "</td>";
echo "<td class= 'inside-while'>" . $row['APDATE'] . "</td>";
echo "</tr>";
}
任何帮助将不胜感激。