-6

Possible Duplicate:
PHP & MySQL Pagination

I'm a bit confused as to how to add pagination to my mysql query, since I am looping through the results and adding them to a variable each time:

$DBQuery3 = mysqli_query($dblink, "SELECT * FROM images WHERE project_id = '$FormProjectID'");

$ProjectContent ='';
                        while($row = mysqli_fetch_array($DBQuery3)) {
                            $DBImageID = $row['image_id'];
                            $DBProjectID = $row['project_id'];
                            $DBImageName = $row['image_name'];
                            $DBImageDescription = $row['image_description'];
                            $DBDateCreated = $row['date_created'];
                            $DBLinkToFile = $row['link_to_file'];
                            $DBLinkToThumb = $row['link_to_thumbnail'];
                            $DBGivenName = $row['given_name'];

                            //if the image was given a name by the user, display it
                            //otherwise display the generated name

                            if (strlen($DBGivenName) > 1) {
                                $FileName = $DBGivenName;
                            } else {
                                $FileName = $DBImageName;
                            }

                            $ProjectContent .= '
                                <a href="index.php?page=image&id='.$DBImageID.'"><img src="uploads/'.$DBLinkToThumb.'" width="150px" height="150px" alt="'.$FileName.'" title="'.$FileName.'"/></a>
                            ';

Any pointing in the right direction would be greatly appreciated.

Community
  • 1
  • 1
BrokenCode
  • 951
  • 4
  • 19
  • 43

1 Answers1

0

Hy,

Try use a php pagination script, there are a lot on the net, just search for those words.

For example this: http://www.coursesweb.net/php-mysql/pagination-class-script_s2 can paginate data stored into a database, or into an array.

CoursesWeb
  • 4,179
  • 3
  • 21
  • 27