The following code creates the photo gallery with 12 images per page and then paginates to the next page. What I would like to do is when a user clicks on one of the images, dynamically create a page so I don't have to create a page for each image since I have at least 100 images. When this page is created, I would like to have it pull some information from the database. I know how to pull information from the database, I am not sure how to do it when clicking on a link and how to do it based on that link.
thanks
<?
$server = "**";
$userid = "";
$pass = "";
$database = "**";
$dbtable = "tshirts";
$limit = 12;
$con = mysql_connect("$server","$userid","$pass") or die ("Huh? What Server");
$db = mysql_select_db("$database",$con) or die("I said WHAT database");
if (empty($offset) || $offset < 0) {
$offset=0;
}
if (empty($index)) $index=0;
$getrows = mysql_query("select from $dbtable", $con);
$numrows=mysql_num_rows($getrows);
$path ="/NewCindys/Images/TShirts/";
$shtml =".shtml";
$linkpath ="/TShirts/";
$query = mysql_query ("select from $dbtable where id ='$_GET[id]' limit $offset,$limit", $con);
if ($numrows <= $limit) {
}
else {
if ($offset!=0) {
$prevoffset=$offset-$limit;
echo "<a onMouseOver=\"window.status='Previous $limit Results'; return true\"; href=\"$PHP_SELF?offset=$prevoffset&index=$prevoffset\"><p align=right><B>[Previous]</B></a>";
}
else echo "<p align=right><b>[Previous]</b> ";
$pages = intval($numrows/$limit);
if ($numrows%$limit) {
$pages++;
}
for ($i=1;$i<=$pages;$i++) {
if (($offset/$limit) == ($i-1)) {
echo " <b>$i</b> ";
} else {
$newoffset=$limit*($i-1);
echo " <a onMouseOver=\"window.status='Page $i Results'; return true\"; href=\"$PHP_SELF?offset=$newoffset&index=$newoffset\"><B>$i</B></a> \n";
}
}
if (!((($offset/$limit)+1)==$pages) && $pages!=1) {
$newoffset=$offset+$limit;
echo " <a onMouseOver=\"window.status='Next $limit Results'; return true\"; href=\"$PHP_SELF?offset=$newoffset&index=$newoffset\"><B>[Next]</B></a></p>\n";
} else echo "<b>[Next]</b></p>";
}
echo "<table align=center border=0><tr>";
$num=1;
while ($result=mysql_fetch_array($query)){
$num = ($num < 5 ? $num : 1);
$index++; / Increment the line index by 1 /
echo "<td align=center class='shirts'><a href=\"$linkpath".$result[image]."$shtml"."\"><img border=1 height=123 width=95 alt=\"".$result[shirtname]."\" src=\"".$path.$result[id].$type."\"></a><br>$result[shirtname]</td>";
if ($num==4 && $index!=$numrows)
echo '</tr><tr>';
$num++;
}
echo ("</tr></table>");
mysql_close($con);
?>