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> </td>");
$RsImage_list_endRow++;
}
echo("</tr>");
}?>
</table>
No comments posted yet
Your Answer:
Login to answer
111
48
Other forums
PHP File Upload Problem
Hi, I have written a very simple file upload script but it fails for reasons I can't explain. Hope
Can we convert non uni code system into unicode
Hi All,
Presently i am using non-unicode system and the sap version is 4.7.
Can i c
SOAP Issue
Hi,
I am facing some understanding problem with SOAP basic.kindly recommend some SOAP expert.
Multiple Do / While Statements?
I'm still very new to PHP, and running in to a problem when trying to execute a do/while loop inside
How to submit a form to the same page?
I have a table containing information about books in my library and this table has the following col
Running External Scripts
I am very new to PHP and am not even sure what I'm asking is possible. I have just installed mediaW
Beginners syntax and loop questions - help please!
Hi everyone,
I have some problems with php code. I'm currently in the middle of learning php,
Not "Just Another" MMORPG - text based.
Hello,
I've been learning MySQL and PHP for the last 2-3 years.
Though, I've had long paus
strptime() equivalent for php4 ?!
Greetings!
this is my first post, thank you in advance for your replies.
Well, the ti
LSB (PHP 5.3) problem with static value!
hello,
i'm having a problem. static::$text variable gets lost at some point. can someone plea