do while conditions


Posted on 16th Feb 2014 07:03 pm by admin

i want to display 6 images in a 2x3 table
now what would be the correct logic to
count that there are 6 images results
and if there are more than 6 images loop and echo the rest but not in the table
Did you know?Explore Trending and Topic pages for more stories like this.
but as links?

the idea is to have 6 thumbnails and then a large images in a gallery

this is what i played with it gives me the table i want , how should i add the additional condition - echo the remaining inages after the 6th??

Code: <table>
<tr>
<?php
$RsImage_list_endRow = 0;
$RsImage_list_columns = 2; // number of columns
$RsImage_list_hloopRow1 = 0; // first row flag
do {
if($RsImage_list_endRow == 0 && $RsImage_list_hloopRow1++ != 0) echo "<tr>";
?>
<td width="85"><a href="/images/<?php echo $row_RsImage_list['imagename']; ?>" rel="lightbox[<?php echo $row_RsImage_list['ProductID']; ?>]"><img src="<?php echo $row_RsImage_list['imagename']; ?>" width="85" height="64" border="0"/></a></td>
<?php $RsImage_list_endRow++;
if($RsImage_list_endRow >= $RsImage_list_columns) {
?>
</tr>
<?php
$RsImage_list_endRow = 0;
}
} while ($row_RsImage_list = mysql_fetch_assoc($RsImage_list));
if($RsImage_list_endRow != 0) {
while ($RsImage_list_endRow < $RsImage_list_columns) {
echo("<td>&nbsp;</td>");
$RsImage_list_endRow++;
}
echo("</tr>");
}?>
</table>

No comments posted yet

Your Answer:

Login to answer
111 Like 48 Dislike
Previous forums Next forums
Other forums

shoping cart issues
i´ve wrote this and works when i add an item to, my cart, but when i want to add othrer item just

Join Query Help
Hi all,

I am having problems with the below code, which we shall call 'my first join query'!

SQl num_rows problem
when i try to count rows from an SQL select i get an warning

Code: [Select]$countviews = mysq

ASP.NET Validation Event Cycle
Hi,
I have asp button as follow:

weird problem
last time, i did post a topic concerning why my page sometime will load as blank page when using IE.

breaking a text file into paragraphs based on strings
I have a text file of email addresses that is all squished together. It looks like this:

abc

filesize() returns 0
I have a socket program that runs in an infinite loop, listening for connections, in this socket I h

include problem
I have my root folder as:
Code: $root = $_SERVER["SITE_HTMLROOT"]; // the server root<

Querying info from one table based on info in another
Hi, I am currently trying to make a part for my user driven website where one user can subscribe to

help need on ob_start()
Hi

I am a newbie in php, I have a code
Line number On/Off | Expand/Contract <?phpo

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash