I have a php/mysql list, where I can display lots of thumbnails.
My problem is that there are too many images to display in one page. I would like to divide it so that I can get some page links or something at the bottom?
Like: 1,2,3,4,5,6,7,8 or next and prev…
Here is the current code:
<?php
if ($db_found) {
$SQL = "SELECT * FROM myTable";
$result = mysql_query($SQL);
while ($db_field = mysql_fetch_assoc($result)) {
echo '<li>';
echo '<div class="thumb"><img src="images/thumbnails/'.$db_field['image'].'" alt="" /></a></div>';
echo '</li>';
}
mysql_close($db_handle);
}
?>
How can I add some page links here?
it’s much more easy with Jquery but i Recommends you to work with PHP for start,
It can only develop your head than to add some JQuery code will get you everything.
anyway simple paging with PHP goes like that,
the key’s for learning this code is to understand:
intval,LIMIT,mysql_num_rows,mysql_fetch_assoc,mysql_fetch_row,ceil,COUNT
after you will learn each off them the code will be much easy to understand and you can develop it and add some of your own Improvements.
The Credit for this Excellent site : PHPGuide
The Code is Very Easy to understand and very simple.
and about the prev and forward page it’s one of the improvements you will do after you get this code.