Code: Select all
$query = "SELECT * FROM thumb LIMIT 0, 4";Code: Select all
$query = "SELECT * FROM thumb LIMIT 4, 4";Example, on ?id=1, it would have the above query but on ?id=2, it would run a query like the one below.
Code: Select all
$query = "SELECT * FROM thumb LIMIT 8, 4";Code: Select all
$query = "SELECT * FROM thumb LIMIT 12, 4";To put it simple:
First query on ?id=1 would start pulling data from row 1 to 4 and the second query on ?id=1 to start pulling data from row 5 to row 8.
While query 1 on ?id=2 start pulling data from row 9 to row 12 and query 2 on ?id=2 from row 13 to row 16.
Here is example of code:
Code: Select all
<?php
// database connection info
$query = "SELECT * FROM thumb LIMIT 0, 4";
$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 LIMIT 4, 4";
$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 code to go between the 2 row of images is:
Code: Select all
<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>1 2 3 4
-------
5 6 7 8
But I don't know how to get it there, yet.