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
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

Syntax Help
Code:


im having trouble with that code snipped
Parse error: syntax error, unexpec

Problem with php's rename function
So, i'm having a problem with the php rename function. Basically my script 'delete_user.php' attempt

TimeStamp Column Problem...
I'm mad at my self and thinking I'm a little retarded. It just be some one mistake I'm missing here.

Really need helps regarding Pagination with Sort
I need someone helps regarding pagination problem...i actually want to make my page limited to let s

upload photo limits
ive got a upload photo script and im just trying to make more secure currently it limits size and as

PHP Game
hy i was wondering what's the best method in order to make some automatic updates in a php game
<

Unifying logins of two different scripts
I have two different game scripts which I want to embed on my own site. The problem is I don't want

Custom Container in module pool program
Hello everyone,

I have created a custom control in my module pool screen. Now I want to s

Weird Problem with curl while sending data
I am facing a weird problem with sending data to a site via curl.

If i send the value by this

Multiple Dropdown Selections
I have a form that let's a user insert a page with the ability to select categories. I want them to

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