Sandcrawler
02-28-2010, 11:50 PM
I need to get the previous and next ID's from a table. The table has a group that they are in as well. I have the following code, but it will only pull the ID of the current page.
$sqlnext = mysql_query ("SELECT * FROM tutorials WHERE id > '$id' AND series='$series' ORDER BY id LIMIT 1");
$rownext = mysql_fetch_array ($sqlnext);
$nextid = $row['id'];
$nextname = $row['name'];
if((!empty($nextid)) && ($nextid != $id))
{
$next="<a href=\"./$basepage?page=tutorials&command=view&id=$nextid\">$nextname</a>";
}
I can offer more code if needed.
$sqlnext = mysql_query ("SELECT * FROM tutorials WHERE id > '$id' AND series='$series' ORDER BY id LIMIT 1");
$rownext = mysql_fetch_array ($sqlnext);
$nextid = $row['id'];
$nextname = $row['name'];
if((!empty($nextid)) && ($nextid != $id))
{
$next="<a href=\"./$basepage?page=tutorials&command=view&id=$nextid\">$nextname</a>";
}
I can offer more code if needed.