I am trying to implement pagination on my PHP website to display images from a database and limit them to only show a certain amount of images per page..

Now i have been following this tutorial:-


I have the following code:-

PHP Code:

include("paginator.php"); //Paginator class is within this file
$pages = new Paginator;  
$pages->items_total $num_rows[0];  
$pages->mid_range 9;  
$query "SELECT image_name FROM images WHERE image_name != '' ORDER BY image_id ASC $pages->limit";
$result =  mysql_query ($query);
$row mysql_fetch_array($result,MYSQL_ASSOC);
"<div><a href='images/$row[image_name]' rel='lightbox' title='$row[caption]'><img src='images/$row[image_name]' alt='' width='80' height='80'/></a><span>$row[caption]</span></div>";
Now the code above has an include file "paginator.php" which includes the class given in the tutorial.

Now when it comes to displaying the fields from the database i am having trouble. I am receiving this error:-

PHP Code:
Warningmysql_fetch_array(): supplied argument is not a valid MySQL result resource in /domains/skindeepapparel.com/http/lou/gallery.php on line 90 
Can anyone help..

If not can you offer some other help in terms of pagination..