mysql_num_rows() Problem
Posted: Fri Jun 04, 2010 6:17 am
Hi
I am getting this Warning when running this code.
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\movie\moviedetails.php on line 306 where line 306 is:
Here is the part of the code
I am getting this Warning when running this code.
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\wamp\www\movie\moviedetails.php on line 306 where line 306 is:
Code: Select all
if (mysql_num_rows($recommendations) > 0) {
Code: Select all
<?php
echo "<div class=\"blog2\"><h4 style=\"margin: 0\">We Recommend this Movie for you:</h4><p />";
echo "<hr style=\"border: 1px solid #06C\" />";
$query = "SELECT genretypes.*, genres.*, movies.* FROM movies INNER JOIN genres ON genres.MovieID = movies.MovieID INNER JOIN genretypes ON genres.GenreTypeID = genretypes.GenreTypeID WHERE genretypes.GenreTypeID = " . $movies2['GenreID'] . " AND Rating != 0 ORDER BY RAND() LIMIT 0,5";
$recommendations = mysql_query($query);
if (mysql_num_rows($recommendations) > 0) {
echo "<table align=\"center\"><tr>";
while ($recommendation = mysql_fetch_array($recommendations)) {
echo "<td><a href=\"moviedetails.php?id=" . $recommendation['MovieID'] . "\">" . '<img src="Images/Movies/' . $recommendation['Filename'] . '" width="125" height="185" />' . "</a></td>";
}
echo "</tr></table>";
}
echo "</div>";
?>