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
MFC GUI Programming
I am working on a project right now that requires me to create a MFC Windows GUI. Basically it need
BackButton Behaviour in AJAX
I have an ASPX Page AJAX Enabled!The page has a gridView and a DDL for filtering on it. The Gridview
session variable problem
Session variable is not working in Fire fox i am getting null value but it is working fine in IE.
How can I get my program to read a larger array ??
Hi:
I have this program that reads from an array to do calculations. The array are just t
Problems with adding a link to one position in a 'foreach' loop, please help
Hello!
Iam pretty new to programming and I wanna create a table with users from an array. It
Table sorting
Hi,
I'm trying to modify the following in order to make the output table sorted alphabeticall
Passing Arguments to execlp()
I'm writing a program that mimics a unix shell. It's supposed to take commands with arguments and ex
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
How to refresh a parent page from a modal popup
Hi,I have a modal popup in which I need to upload a file and store in the database should give a mes
help with Get_
ok some how this is not working i am not sure what i am doing wrong here but what this does is when