hi,
i have a bit of a problem with arrays. all editorials are in a database (scanner). when an editorial is shown the url would look like scanner.php?id2=12
now, i would like to make a link that points to the previous editorial. here arises a problem - although the id-s are auto incremented, users can delete editorials as they wish and so i just can't use $id2 - 1
so, i take all the id-s in scanner into an array and then i would like to use a for loop to reach a point in that array where the array id equals $id2.
however, i don't know anything about for loops and i'm badly stuck.
my code is as follows:
$scanprev = ("SELECT id FROM scanner order by id desc");
while ($id34 = mysql_fetch_array($prevresult))
{
$id35[] = $id34['id'];
}
for ($uu = current($id35);;next($id35)) {
if ($uu == $id2) {
break;
}
print $uu;
}
the next step would be to make another next($id35); and get the id for previous editorial.
if anybody could help me (or even point out a better way), i would greatly appreciate it.
peeter