Mythotical wrote:I"m afraid to touch anything as I don't wanna break it.
Then we're afraid to offer suggestions. C'mon, be brave! You only need to change the 'num' reference in two places!
Also, as to your problem with a second page, try changing this line:
$totalpages = round($totalpages,0);
to use the [man]ceil/man function instead. Why? You always want to round up. Think about it: if you have enough images for exactly 3 pages, then you should display three pages, right? Well, let's say you uploaded 3 more images, now you have enough for exactly 3.25 pages. Now, if you round() that number, it's going to round down to 3, naturally. What we want, though, is 4 - otherwise we're missing a few images.
EDIT: Oh yeah, almost forgot. As an optimization, you can get rid of this line:
$totalpages = mysql_num_rows(mysql_query("SELECT * from `tblimage`"));
in favor of something like:
$totalpages = mysql_result(mysql_query("SELECT COUNT(*) FROM `tblimage`"), 0);
EDIT2: Then again, if we're dealing with optimization, it might just be better to include the COUNT(*) in your other query, eliminating the second query altogether. This is my best guess, but I'm still looking into it.