I've tried what Rajesh suggested, but I don't think I did it properly. Here is
the code that I
tried and it gave me an error in my SQL syntax.
while ($photo = mysql_fetch_array($photoresult))
{
$copy1 = $photo;
$copy2 = $photo;
$next_value = next($copy1);
$prev_value = prev($copy2);
print '<table width="64" border="0" cellspacing="0" cellpadding="5">
<tr>
<td colspan="2">';
print '<img
src="../../gallery/'.$photo["production"].'/'.$photo
["file"].'" border="0">';
print '</td>
</tr>
<tr>
<td colspan="2">'.$photo["caption"];
if(!empty($photo["thanks"]))
{
print ' <i>(Thank you to '.$photo["thanks"].' for this image)</i>';
}
print ' </td>
</tr>
<tr>
<td><a
href="photos_zoom.php?$prev_value"><< Previous</
a></td>
<td align="right"><a
href="photos_zoom.php?$next_value">Next
>></a></td>
</tr>
</table>';
}
What am I doing wrong?
--- In [email protected], Rajesh Kumar <[EMAIL PROTECTED]> wrote:
>
> Assuming your sorted rows are in an array, you can use the next() and
> prev() functions to move the array pointer forwards and backwards
> respectively.
>
> So say your sorted array is in $array, you can do something like this:
>
> $copy1 = $array;
> $copy2 = $array;
>
> $next_value = next($copy1);
> $prev_value = prev($copy2);
>
> --
> Rajesh
>
> whoisquilty wrote:
>
> > I've got a sorted found set of rows. Is there a command to go to the
> > next row in the sorted set?
> >
> > I'm trying to create a slide show of photos. They are entered in a
> > table and sorted by a sortno column. And I'd like to create "Next"
> > and "Previous" buttons.
>