I've read it and still have a few problems
new script:
<?php
include("header.inc");
$db = "gallery";
$link = mysql_connect( "user", "pass" );
if ( !$link ) die( "Couldn't connect to MySQL" );
mysql_select_db( $db, $link ) or die( "Couldn't open $db: ".mysql_error() );
$sql = "SELECT * FROM galleryTable Where tour = '$page' ORDER BY id DESC LIMIT '$id', '$numrows'";
$result = mysql_query( $sql, $link );
?>
<p> </p><?php print "$id and $numrows"; ?>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="10%" valign="middle" class="subtitle"><div align="center"></div></td>
<td width="120%" align=center><?php print "<img src=\"/images/archive/$fupload\">"; ?></td>
<td width="10%" valign="middle" class="subtitle"><div align="center"></div></td>
</tr>
<tr>
<td width="10%"> </td>
<td width="80%"><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" valign="top">Tour:</td>
<td width="50%"><?php print " $page "; ?></td>
</tr>
<tr>
<td width="50%" valign="top">Name:</td>
<td width="50%"><?php print " $name "; ?></td>
</tr>
<tr>
<td width="50%" valign="top">Materials:</td>
<td width="50%"><?php print " $materials "; ?></td>
</tr>
<tr>
<td width="50%" valign="top">Size:</td>
<td width="50%"><?php $size = stripslashes($size); print " $size "; ?></td>
</tr>
<tr>
<td width="50%" valign="top">Status:</td>
<td width="50%"><?php print " $status "; ?></td>
</tr>
<tr>
<td width="50%" align="center" class="subtitle">
<?php
$previd = $id--;
$nextid = $id++;
while ( $newArray = mysql_fetch_array($result) )
{
$id = $newArray['id'];
$status = $newArray['status'];
$name = $newArray['name'];
$materials = $newArray['materials'];
$size = $newArray['size'];
$size = htmlspecialchars($size);
$fupload = $newArray['fupload'];
$tupload = $newArray['tupload'];
print "
<a href=\"$PHP_SELF?id=$id&numrows=$numrows&previd=$previd&fupload=$fupload&name=$name&materials=$materials&status=$status&size=$size&page=$page\">previous</a>
</td>
<td width=\"50%\" align=center class=subtitle>
<a href=\"$PHP_SELF?id=$id&numrows=$numrows&nextid=$nextid&fupload=$fupload&name=$name&materials=$materials&status=$status&size=$size&page=$page\">next</a>
";
break;
}
?>
</td>
</tr>
</table></td>
<td width="10%"> </td>
</tr>
</table>
<p> </p>
<?php
mysql_close( $link );
include("footer.inc");
?>
Trouble is that id returns the field in the database which is an auto_increment value for each new database entry, and numrows returns the number of rows selected.
Is there a way to assign each selected entry with a new id newid so that i can go through them?