First
query page display all results <?php //The
database has been connected to, and we have a query result. $result = mysql_query("select
* from table"); $num_rows = mysql_num_rows($result); if ($myrow
= mysql_fetch_array($result)) { $thumb='<img src=http://your_website/thumbs/'; $web='http://www.yourwebsite/detail.php?name=';
$f='<font
face=verdana,arial size=2'; $s='<span style=padding-left:3px';
echo
"<table border=0>\n"; echo "<tr><td></td><td></td><td></td><td></td></tr>\n"; do
{ //present
lots of references and a link to detail.php?name=[reference]
printf("<tr><td><a
href=$web%s>$thumb%s.jpg></a></td><td><a href=$web%s>$s>$f>%s</font></span></a></td><td>$s>$f>%s</font></span></td><td>$s>$f>%s</font></span></td><td>$f>%s</font></td>
</tr>\n", $myrow["reference"], $myrow["thumb"],
$myrow["reference"], $myrow["shortdescription"], $myrow["suburb"],
$myrow["ID"],
$myrow["price"]); } while ($myrow = mysql_fetch_array($result));
echo "</table>\n"; echo "<br>"; }
else { echo "Sorry, no records available"; }
detail.php <?php $ref="$name"; if
(empty($ref)) { echo "Oops, the reference has been terminated with extreme
prejudice"; exit; }
(DISPLAY ALL THE INFO YOU WISH FOR THE REFERENCE)
// NOW THE NEXT REF
//The database has been connected to, and we have a query result.
$result2 = mysql_query("select * from [table]");
$num_rows = mysql_num_rows($result2);
$i=0;
while ($i < $num_rows) {
$next=mysql_result($result2,$i,"ref");
++$i;
$myarray = array("$i"=>"$next");
foreach($myarray as $key=>$value) {
}
if ($value == "$ref"){
$b=($key);
$c=($key+1);
$x=($records-$b);
$z=($x+1);
}
if ($key == "$a") echo "<a href=../detail/index.php?name=$value>Previous Record</a> ";
if ($num_rows < $c) {
echo "There are no more records";
} else {
if ($key == "$c") echo "<a href=../detail/index.php?name=$value>Next Record</a>";
}
}
?> |