Nicholas Posted January 16, 2007 Share Posted January 16, 2007 I've got close to 30 or so photos on my site, and I'd like them to be displayed in sets of 10, with a "Previous" and "Next" link allowing progress backward or forward through the pictures. You've all seen it, but can you help me to do it?Here's what I have:[quote] # ------------------------------------------------- # photography page content # ------------------------------------------------- case 'photography-s': print '<div align="left">' . "\n"; connect($error, $type); [color=red]# CONNECT TO THE DATABASE[/color] print '<h1>my photography (<a href="http://hobbes.cjb.cc/art.php?page=photography-s">standard</a> | <a href="http://hobbes.cjb.cc/art.php?page=photography-p">panoramic</a>)</h1><br/>' . "\n"; print '<table cellpadding="0" cellspacing="0" width="100%">' . "\n" . $_SESSION['end'] = "10"; [color=red]# SET WHAT VALUE WE NEED TO END AT [/color] $start = ($_SESSION['end'] - 9); [color=red]# AND WHAT WE START AT[/color] $end = $_SESSION['end']; [color=red]# SIMPLER FORM...[/color] $open = '<a href="#" onClick="MyWindow=window.open(\''; [color=red]######################[/color] $mid = "','MyWindow','scrollbars=yes,"; [color=red]## THESE ARE "SHORTCUTS"[/color] $close = "'); return false;\">"; [color=red]## IF YOU WILL[/color] $img = '<img class="img" border="0" src="'; [color=red]######################[/color] for ($id=$start;$id++;$id<=$end) { [color=red]# SET UP A FOR LOOP TO GET THE DESIRED RANGE OF ID'S[/color] $result = mysql_query("SELECT title, thumb, image, description, height, width FROM art_photo WHERE id ='" . ($id) . "'"); [color=red]# QUERY THE DATABASE FOR THE SPECIFIC ID'S[/color] $photos = mysql_fetch_assoc($result); [color=red]# AND PLACE THAT INTO THE ARRAY "PHOTOS"[/color] print $photos; [color=red]# A TEST...[/color] print ' <tr>' . "\n" . ' <td height="120" width="160">' . "\n"; [color=red]# THE FOLLOWING COUPLE OF LINES SET UP THE CELLS CONTAINING THE PHOTOS AND DESCRIPTIONS[/color] print $open . $photos["image"] . $mid . 'width=' . $photos["width"] . ',height=' . $photos["height"] . ',left=105,top=120' . $close . $img . $photos["thumb"] . '" alt="' . $photos["title"] . '" title="' . $photos["title"] . '"/></a></td>' . "\n" . ' <td>' . "\n" . $photos['desc'] . "\n" . ' </td>' . "\n" . ' </tr>' . "\n"; } print ' <tr>' . "\n" . ' <td style="text-align: left;"><a href="http://hobbes.cjb.cc/art.php?page=photography-s"></td>' . "\n" . [color=red]# REWIND THE START ID[/color] ' <td style="text-align: right;"><a href="http://hobbes.cjb.cc/art.php?page=photography-s"></td>' . "\n" . [color=red]# ADVANCE THE START ID[/color] ' </tr>' . "\n" . '</table>' . "\n"; break;[/quote]Any help is greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/34353-dividing-lots-of-content-into-multiple-pages/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.