I have a table which stores the location of images when I upload them, and a site is supposed to display the images. The site displays the proper number of images, but it just inherits the image location from the previous row (so you end up with 15 of the same picture being displayed)
The code is as follows:
$query = "SELECT FROM photographs ORDER BY number DESC";
$result = mysql_query($query);
$num = mysql_numrows($result);
$query2 = "SELECT FROM photographs LIMIT $val2, $val";
$result2 = mysql_query($query2);
$num2 = mysql_numrows($result2);
$i=0;
$location=mysql_result($result2,$i,"location");
$totpage=round(($num/15)+0.5);
$curpage=round(($val/15)+.05);
while ($i < $num2) {
echo
?>
<img src=images/<?php echo $location; ?>>  
<?php
++$i;
}
?>
any suggestions?