Hi I have this function that works great but the volume of photos could get really large. I've tried numerous tutorials on pagination but with no luck.
Does anyone know a simple way to have 15 instances on each page. Any ideas much appreciated
Does anyone know a simple way to have 15 instances on each page. Any ideas much appreciated
Code:
function show_homepage(){
include_once('../../jj/connect_to_db.php');
$sql=mysql_query("SELECT *
FROM tblphoto
ORDER BY RAND()");
$num_rows=mysql_num_rows($sql);
if($num_rows==0){
$content = "<h2>The Wedding of Jodi & Jimmy</h2>
<p>October 10, 2008</p>
<p>There are currently no photos, please try again later</p>";
}else{
$content = "<h2>The Wedding of Jodi & Jimmy</h2>
<p>October 10, 2008</p>
<p>Click on photo to view larger image</p>
<div id='gallery'>";
while(list($ID, $photo, $nameID,$layout)=mysql_fetch_row($sql)){
$qry=mysql_query("SELECT name
FROM tblname
WHERE ID = '$nameID'");
list($name)=mysql_fetch_row($qry);
if($layout=='l'){
$class = 'land';
$pos = 'width = 160';
}else{
$class = 'port';
$pos = 'height = 150';
}
$link = $_SERVER['PHP_SELF']."?jj=image_large&ID=$ID&name=$name";
$content .="<div class='imageholder'>
<a href=$link><img src=$photo alt='Wedding Photo' $pos class=$class /></a>
<div class='text'>
Taken by: $name
</div>
</div> ";
}
$content .= "</div>";
}
echo $content;
}