我需要显示一个表格,显示将笑话输入数据库的用户。我有一个笑话名称“笑话”的表和一个名为“作者”的用户的表笑话表有 id、joketext、jokedate、authorid 作者表有 id、名称、电子邮件所以“authorid”与“ id' 在作者表中。
<?php
$con=mysqli_connect("localhost","user","password","ijdb");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysql_query("SELECT joke.id, joketext, name, email FROM joke INNER JOIN author
ON authorid = author.id");
echo "<form action='delete1.php' method='post'>
<table border='1'>
<tr>
<th>Joke</th>
<th>Date</th>
<th>Name</th>
<th>Email</th>
<th>Delete</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['joketext'] . "</td>";
echo "<td>" . $row['jokedate'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td><input type='submit' name='deleteItem' value='".$row['id']."' /></td>";
echo "</tr>";
}
echo "</table>";
echo "</form></br>";
mysqli_close($con);
?>
我收到此错误警告:mysqli_fetch_array() 期望参数 1 为 mysqli_result,布尔值在第 22 行的 C:\xampp\htdocs\kimmy\jokes\joke1.php 和一个空表中给出
谢谢