gpt4 book ai didi

php - 我不知道的 SQL 错误消息 : "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource"

转载 作者:太空宇宙 更新时间:2023-11-03 11:10:47 24 4
gpt4 key购买 nike

这个问题在这里已经有了答案:




9年前关闭。




Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
mysql_num_rows(): supplied argument is not a valid MySQL result resource
Warning: mysql_fetch_* expects parameter 1 to be resource, boolean given error



我正在尝试通过 url 传递一个 id,在该 url 中我收到一条我不知道的错误消息。我的代码如下:
 <?php

$result = mysql_query("SELECT * FROM Agendas INNER JOIN Meetings ON Meetings.meeting_id = Agendas.meeting_id WHERE approval = 'pending' ORDER BY Agendas.meeting_id DESC")
or die(mysql_error());

if (mysql_num_rows($result) == 0) {
echo '<h2>No Action Is Required Yet</h2>';
} else {

while($info = mysql_fetch_array($result))
{

echo "<tr>";
echo "<td><br/>" .'Meeting Title: '. $info['title']." </td>";
echo "<td><br/><br/>" .'<a href="viewagenda.php?agenda_id=' . $info['agenda_id'] . '">View Agenda</a> '." </td>";
echo "<hr>";
}
}
echo "</tr>";
echo "</table>";


?>

viewagenda.php 如下:
 <?php
$id = $_GET['agenda_id'];

$query = mysql_query("SELECT * FROM Agendas INNER JOIN Meetings ON Meetings.meeting_id = Agendas.meeting_id WHERE agenda_id = '$id'")
or die(mysql_error());

if (mysql_num_rows($result) == 0) {
echo '<hr><h2>There Arent Any Agendas For This Meeting Yet</h2>';
} else {

while($info = mysql_fetch_array($result))
{

echo "<tr>";
echo "<td><br/>" .'Title: '. $info['title']." </td>";
echo "<td><br/>" .'Subject: '. $info['subject']. "</td>";
echo "<td><br/>" .'Duration: '. $info['duration']. "</td>";

echo "<hr>";
}
}
echo "</tr>";
echo "</table>";
?>

我得到的错误信息是:

'警告:mysql_num_rows():提供的参数不是第 70 行 E:\webareas\hj942\conference\Chairperson\viewagenda.php 中的有效 MySQL 结果资源'

我的表格如下:

session :meeting_id、头衔、主席、秘书、事件

议程:议程 ID、主题、持续时间、 session ID

最佳答案

我猜你的意思是:

$result = mysql_query("SELECT * FROM Agendas INNER JOIN Meetings ON  ...

因为您使用的是 $result mysql_num_rows 中的变量:
if (mysql_num_rows($result) == 0) {

关于php - 我不知道的 SQL 错误消息 : "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8730500/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com