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
Getting PHP to ammended the selected in option field
Hey Guys
thanks for everyones help so far. This site and its users are oozing awesomness.
Re-Order by ID Number
I have a cms set up for inputting an image, thumb, title, pdf, and eps. When input the database ass
random generation
hi
i need help with generating this
numbers from 1-12
i want to generate in ran
Please Help my PHP Dating Function.
Hi everyone!
Well here is my code that displays this:
It works wonderful.
php email checker
I am having alot of trouble finding info on how to do these email things. I need to do the following
PHP Programming error. Please help!
Hi there,
Am making a website for a friend and have encountered a problem that i need fixing
ldap connection
We are using ldap to get user information from the domain controller. It was working before. Recentl
Upload file!
Ok i have a form..
Code: <form name="form1" method="post" action=&quo
PHP, Arrays & A Lot Of Confusion
I've been doing basic PHP work on sites for a few years now, but I've never been tempted to learn ho
Help uploading .JPG
I have a problem with upload images when the ending is .JPG capitalized.. I really don't know what c