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
timed header image rotation
I have a joomla site and I was trying to setup a rotating image based on timing NOT just refreshing
Help with looping
I have a comma separated list of colors taken from a database ($ICo) and a directory of images named
A rank users order by points
I want to make an insert from table 'rank' , with number (rank) from the cod blow, to fild users.ran
text box alphanumeric caracters only
hi all!
I have search on google on how to enter in a test box only caracters A-Z,a-z,0-9 usi
unoconv doc convert to pdf code prob
PHP/5.3.1
Hi. I am trying to use this code to convert docs to .pdf utilizing unoconv. Howe
Socket problem
Hello,
Earlier I posted about my problem with my socket script. It took up to 100% CPU usage.
styling a RadioButtonList
HiI need to have a radio button and close to it, its lable, then a space then another set of those.
standard ALV application toolbar, into custom report....
HI,
I have a question regarding displaying standard ALV menu path and application toolbar
Problem Dereferencing
With these types and tables:
CREATE TYPE MANAGER AS OBJECT (
MGR_ID INTEGER,
problems with php variables in mysql query
i can't seem to get the following query to work.
select $q1c from $vote_rate where id = $re