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

help with multi-update
Now sure how to ask this really....
10g database if that matters.

I have a customer

downloading a file as HTML
Hi.
I'm rather confused with forcing a download. I just want to save dynamic content (from $_SESS

More pug propaganda.
http://www.youtube.com/watch?v=8Kkrmubsgf8

The commercial is definitely worth watching pug aw

ALV List Display to point to another report on Double Click
Hi,

I want my ALV List Display to point to another report on Double Click on its line ite

php web service error
hey guys,
I'm working on a project requires the use of web services. I've been trying a few tutor

Am I setting up my sites oldschool?
Ok,

When I create a site I open a basic template that I have created that consists of a css f

Help: calling function
Hi,
Is it possible to call a php function on page close?
If yes, could you explain how and whe

blank page.... nothing is happening.
I'm new to a lot of this but in the last 24hrs have learned a lot.
Installed latest version of my

Edit MySQL Row Using PHP and HTML Form
Hello,

Here's what I'm trying to do. Build a page where a user enters a MySQL row number in.

Add trigger to UpdatePanel programmatically
Hi,I'm working on a website which uses AJAX and Masterpages. What I have is an AJAX UpdatePanel whi

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