HI!
I need some kind of script that shows Prev and Next records on a data base… I already have one that works… but only if the records are followed.
I have in the same table several kinds of data and the detail page should only show all the records of the same kind. this is my code:
[php]
<?php mysql_connect ("localhost", "***", "***") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("*****"); $result =mysql_query( "SELECT * FROM T_DECORACAO WHERE (ID='$ID') AND (TIPO='igrejas')"); $imgurl = "*****/"; while($resposta = @mysql_fetch_array($result)) { $IDDET=$resposta['ID']; $TIPO=$resposta['TIPO']; $FOTOG=$imgurl.$resposta['FOTOG']; $NEXT= $IDDET+1; $PREV= $IDDET-1; ?> <img src="<?php echo $FOTOG;?>" ></div></td>
</tr>
<tr>
<td height="20"><div align="center"><span class="style5"><?php
if ($IDDET==1) {
echo “Seguinte >” ;
} else {
echo “< Anterior | Seguinte >” ;
}
?>
[/php]
in this specific case the IDS are " 1,2,4,5,6,7,8,79,80"
can you help me please???
thankyou
Mod Edit: Added PHP tags for readability.