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> </td>");
$RsImage_list_endRow++;
}
echo("</tr>");
}?>
</table>
No comments posted yet
Your Answer:
Login to answer
111
48
Other forums
that old Malformed Headers problem again!!!!! HELP!!!!!!
I've read the http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
I don't think my c
Writing Windows Device Drivers with C
Yes: one of the nice features of C is void*. You can put anything there and get anything out. Very
$variable = $variable
Hello
Sorry if this is a really simple question but I have run out of ideas. Is there a reall
Namespace Problem
I'm having problem with a section of code with a variable namespace.
This code works fine:
To add a field on the screen XK02.
Hi All,
How to add an additional field in the vendor change control screen XK02.
The
Strip Slashes Help
I've got a script that i've downloaded of the net to edit multiple fields from my sql database, and
Unique Visitor Tracking
Hello. Currently, I run a voting site where voters are tracked by their IP address and can only vote
if description does not contain the following words
Hello everyone,
I am parsing a MS Excel (.xls) file and adding it's content to a mySQL databa
PHP Thumbnail Creation
Ok so i use this function to create thumbnails:
Code: [Select]function createthumb($name,$fil
MySQL noob question
hi guys
I have a simple mysql table set up, along the lines of
Col 1 - Col 2 - Date_l