私は以下のコードを持っています。mysql_num_rows()は有効なリソースではありません - mysql_error()は何も表示しません
include("DBHeader.inc.php");
include("libs/ps_pagination.php");
$sql = "SELECT * FROM Products P, Manufacturers M WHERE M.sManufacturerCode='$LC' AND M.iManufacturerID=P.iManufacturerID";
$rs = mysql_query($sql);
echo $sql;
$pager = new PS_Pagination($conn, $sql, 3, 4, null);
$rs = $pager->paginate();
$num = mysql_num_rows($rs) or die('Database Error: ' . mysql_error());
if ($num >= 1) {
echo "<table border='0' id='tbProd' class='tablesorter' style='width:520px;'>
<thead>
<tr>
<th>Product Code</th>
<th>Product Name</th>
<th> </th>
</tr>
</thead>
<tbody>";
//Looping through the retrieved records
while($row = mysql_fetch_array($rs))
{
echo "<tr class='prodRow'>";
echo "<td>" . $row['sProductCode'] . "</td>";
echo "<td>" . $row['sProductName'] . "</td>";
echo "<td><a href='ProdEdit.php?=" . $row['sProductCode'] . "'><img src='images/manage.gif' alt='Edit " . $row['sProductName'] . "' /></a></td>";
echo "</tr>";
}
echo "</tbody></table>";
}
else {
//if no records found
echo "No records found!";
}
、代わりに、それは私のテーブルからデータを与える、それが画面上に吐き出す:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/nyksys/www/regserver2/search_results.php on line 37
mysql_error()
は実際には全く何も戻っていないので、私は何のような非常に混乱していますエラーはです。 SQLがエコーした時:
SELECT * FROM Products P, Manufacturers M WHERE M.sManufacturerCode='216E3ACAC673DE0260083B5FF809B102B3EC' AND M.iManufacturerID=P.iManufacturerID
私はここでうんざりしています!私はここで簡単なものを見落としていますか?
私は自分のデータベース情報を二重チェックしましたが、問題はないと確信しています。
EDIT-私はチュートリアルに従いますPaginating Your Data with AJAX and Awesome PHP Pagination Classです。
...一部が問題でした – Neal