|
| Hi, I am trying to display all the records from my table in an HTML
table where the posted var $gallery_name.
All i get is this error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in
/home/macca/public_html/somethingartistic/galleries/gallery.php on line
60
It doesnt seem to like the use of mysql_num_rows($result) in the for
loop, yet it works fine on my test machine,
any suggestions why would be greatfully appreciated, or maybe an
alternative way to run the loop for the number of records to from my
table.
Heres the table:
echo '<table class="galleries" width="750" cellpadding="0"
cellspacing="0" bgcolor="#dbe4f5"><tr>';
$gallery_name = $_POST['gallery_name'];
$query = "SELECT * FROM galleries WHERE artist_name =
'$gallery_name'";
$result = mysql_query($query, $dbh);
for ($i = 0; $i < mysql_num_rows($result); $i++ )
{
$image_name = mysql_result($result, $i, "image_name");
$display_width = mysql_result($result, $i, "display_width");
$display_height = mysql_result($result, $i, "display_height");
$width = $display_width / 3;
$height = $display_height / 3;
if($i % 2)
{
$tablerow="</tr><tr>";
}
else
{
$tablerow="";
}
echo '
<td>
<br />
<div align="center">
<form action="view.php" method="post">
<input type="hidden" name="picname"
value="'.$image_name.'" />
<input type="image" src="'.$gallery_name.'/'.$image_name.'"
width="'.$width.'" height="'.$height.'" alt="Gallery picture"
value="submit" />
</form></div><br />
</td>
'.$tablerow.'
';
}
?>
</table>
Thanks
|
|