hello, i am new to php
this is my code currently for showing Page number Links for gallery. (page 1, Page 2 page 3 etcc..)
Based on how many Files to show from database. shows 5 Images per page.
as you can see its not best codeing but it works. i did not put in any error checking in (yet). but just wanted get some idea if any one had comments on how i can improve it.
<?PHP
$num = db_con("SELECT COUNT(title) FROM gallery");
$num = mysql_fetch_array($num); // Number of files
print $num[0] . "images in gallery ";
$pages = ($num[0] / 5); // 5 per page
$to_make = explode (".", $pages); // filter number of pages
// if no over 5 or comes out to 1.232 add 1 to total gallery pages to make
if (!empty($to_make[1])){
$final_no_make = ($to_make[0] + 1);
}
else {
$final_no_make = $to_make[0];
}
// $final_no_make; // This is final number of pages to show
// Number of pages to make show links for
for ($i = 1; $i<= $final_no_make; $i++){
print '<A HREF="gallery.php?view='.$i.'"> Page '.$i.'</A>';
}
?>