Somethings got me a little confused and I can't seem to work a solution to it. I know it must be simple but I just can't figure out why this is happening .
The problem I have with the above code is that during the (while($z < $half){), $b can become a larger number than $a because it obviously bypasses the `main` while. My solution to this was to add an if like so:
Whilst this does what I need it to do, the page never stops loading so I assume the `if` statement is never closing.
The reason I need to do this is because the way it works at the moment it just repeats the same item till it reaches `$half`. Example of my test page (http://www.designsonpine.co.uk ... ctsT.php?sub_categoryid=4).
Anyone got any ideas?
<?php
while($b < $a){
while($z < $half){
echo "<td>";
$images = mysql_query("SELECT * FROM gallery_photos WHERE photo_id = '$image[$b]'");
while($myrow = mysql_fetch_assoc($images))
{
$filename = $myrow['photo_filename'];
$caption = $myrow['photo_caption'];
}
<a href="image.php?code=echo $caption;" target="_blank"><img src="im/echo $images_dir;/tb_echo $filename;" alt="click for larger image"/></a>
php
echo "</td>";
$b = $b + 1;
$z = $z + 1;
}
echo "</tr>";
$z = 0;
?>
<?php
while($z < $half){ // Displays the top row in table (images)
if($b < $a){
echo "<td>";
$images = mysql_query("SELECT * FROM gallery_photos WHERE photo_id = '$image[$b]'");
while($myrow = mysql_fetch_assoc($images))
{
$filename = $myrow['photo_filename'];
$caption = $myrow['photo_caption'];
}
<a href="image.php?code=echo $caption;" target="_blank"><img src="im/echo $images_dir;/tb_echo $filename;" alt="click for larger image"/></a>
php
echo "</td>";
$b = $b + 1;
$z = $z + 1;
}
}
?>
The reason I need to do this is because the way it works at the moment it just repeats the same item till it reaches `$half`. Example of my test page (http://www.designsonpine.co.uk ... ctsT.php?sub_categoryid=4).
Anyone got any ideas?