我只是建立了一个 mysql 数据库,虽然我的 php 没有打印出我想要打印的信息。
这是我的代码的样子(我已经连接到 mysql 并成功创建了一个数据库,我只需要它打印出我插入的内容):
// will insert into the table
mysqli_query ($con, "INSERT INTO alarms(Title, Description, DT)
VALUES(getSucked, Agha will smd, 2013-08-05 00:15:12)");
//will print out what we just insert into the table, ie agha smd's
$result = mysqli_query($con,"SELECT * FROM alarms");
while ($row = mysqli_fetch_array($result))
{
echo $row['alarmID'] . " <br> " . $row['Title'] . " <br> " . $row['Description'] . " <br> " . $row['DT'];
}
//closing connection
mysqli_close($con);
echo "<br><br>connection has been closed";
我不断收到的警告/错误是:
“警告:mysqli_fetch_array() 期望参数 1 为 mysqli_result,布尔值在 B:\DropBox\Dropbox\EbadlyAgha\Ebad\reminders.php 第 83 行给出”
第 83 行是 while 循环开始的地方。