嗨我收到錯誤「Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/**/**/locate.php on line 16
」。警告:mysql_num_rows():提供的參數不是有效的MySQL結果資源
我已經雙重檢查了一切,谷歌搜索/ Stackoverflow搜索,並找不出爲什麼它這樣做。希望有任何想法!
getdate.php
function getDeals($the_type) {
$result = mysql_query("
SELECT *
FROM deals
WHERE deal_type = '" . $the_type . "'
");
}
locate.php?類型=樂趣
$type = $_GET['type'];
include("getdata.php");
getDeals($type);
if (mysql_num_rows($result)) {
echo '<ul>';
while($row = mysql_fetch_array($result))
{
echo '<a href="deal.php?i=' . $row["i"] . '">';
echo '<li class="deal ' . $row["deal_type"] . 'deal">';
echo '<h3>' . $row["deal_title"] . '</h3>';
echo '</li>';
echo '</a>';
}
echo '</ul>';
}
else {
echo '<div class="nodeals">None</div>';
}
可能重複[mysql_fetch_assoc():提供的參數不是在PHP中一個有效的MySQL結果資源(http://stackoverflow.com/questions/1858304/mysql-fetch-assoc-supplied-argument-is-not-a-valid-mysql-result-resource-in-ph) – 2011-09-16 17:50:05
[Warning:mysql_fetch_array():提供的參數不是有效的MySQL的結果](http://stackoverflow.com/questions/795746/warning-mysql-fetch-array-supplied-argument-is-not-a-valid-mysql-result) – 2012-08-09 20:21:22