database photo gallery<

admin

Administrator
Staff member
Ok, I'm making a database driven photo gallery. I'm having trouble wrapping my head around it so to speak. One of the things that it does is display only 15 photos per page. Now it reads in the entire table. Then I have it count the number of rows. That way I have a total number of photos, which I can use to tell me how many pages the gallery will be, or when to stop displaying, etc. The thing is, I use this code to display them atm:

while ($row_info = mysql_fetch_array($result))
{
$path = $row_info["Path"];
$pic = $row_info["Picture"];
$id = $row_info["ID"];
$picture = $path.$pic;
$image_size = getimagesize(trim($picture));
$width = $image_size[0];
$height = $image_size[1];
echo "I display the picture here";
}

The thing is, I have a variable called $start, and what I want it to do, is display 15 entries starting at row $start. Currently, start gets set to 0 if it doesn't exist. I know that it's probably a VERY simple solution, but the rest of the project leading up to it took all my thinking power away from me.you can do that in the mysql query

mysql_query("SELECT * FROM blah LIMIT $start,15");


i think thats right, i may have gotten the $start and 15 backwards, so try that if it doesnt work XDHey Aaron,

<!-- m --><a class="postlink" href="http://www.snippetlibrary.com/tutorials/tutorials.php?id=187">http://www.snippetlibrary.com/tutorials ... php?id=187</a><!-- m -->
 
Top