y2yang Posted May 2, 2009 Share Posted May 2, 2009 Hello, I have a PHP-MySQL script that need help with. I would like a images pagination. 2 rows, 4 column. With a dotted line in between the row. What I want is to have image with id 1-4 to show on bottom row and image id 5-8 to show on top row, there's more images but that's on other page id. Here is my code: <?php // database connection info $conn = mysql_connect('..','..','..') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('..',$conn) or trigger_error("SQL", E_USER_ERROR); $query = "SELECT * FROM thumb"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { ?> <div style="width:132px;height:132px;margin:0 5px 0 5px;float:left;"> <table width="132" style="background:url('http://image.vickizhao.net/starhome/photo/list/img_pic_bg.gif') no-repeat;"> <tr style="height:132px;"> <td><a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/read/read.php?Pid=<?php print $row['id']; ?>"><img id="reSizeImg1" src="<?php print $row['imgpath']; ?>" style="border:solid 1px #ffffff;" alt="" /></a></td> </tr> </table> </div> <?php } ?> <div style="clear:left;overflow:hidden;width:0;height:0;"></div> <p style="margin:20px;"></p> <div class="dotHLine1"></div> <p style="margin:20px;"></p> <?php $query = "SELECT * FROM thumb"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { ?> <div style="width:132px;height:132px;margin:0 5px 0 5px;float:left;"> <table width="132" style="background:url('http://image.vickizhao.net/starhome/photo/list/img_pic_bg.gif') no-repeat;"> <tr style="height:132px;"> <td><a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/starhome/photo/read/read.php?Pid=<?php print $row['id']; ?>"><img id="reSizeImg1" src="<?php print $row['imgpath']; ?>" style="border:solid 1px #ffffff;" alt="" /></a></td> </tr> </table> </div> <?php } ?> The dotted line in between the two rows of images is generated with this code: <div style="clear:left;overflow:hidden;width:0;height:0;"></div> <p style="margin:20px;"></p> <div class="dotHLine1"></div> <p style="margin:20px;"></p> I would like for images with id 1-4 to show on bottom row and images with id 5-8 to show on top row. And images with id 9-12 to show on bottom row of next page and images 13-16 to show on top row of that page. To see how the list looks like, please visit: http://vickizhao.net/starhome/photo/list.php Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/156520-php-mysql-image-pagination/ Share on other sites More sharing options...
ignace Posted May 2, 2009 Share Posted May 2, 2009 http://www.phpfreaks.com/tutorial/basic-pagination Quote Link to comment https://forums.phpfreaks.com/topic/156520-php-mysql-image-pagination/#findComment-824222 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.