Iskib
10-28-2007, 09:50 PM
What I am trying to do is pull images/names then put them in a table. I have done this. Now I want it to loop the table 4 times across then drop down <tr></tr> ????
With the code I have so far it does 4 then drops the maining down and does not cont to do 4 then drop down until none are left.
Here is the code can anyone help this noob php learner see the prob ?
<?php
$n = count($contactlist);
for ($i=0; $i<$n; $i++) {
$contact = $contactlist[$i];
$name = $contact->name;
$imgurl = $contact->imgurl;
$uid = $contact->uid;
if ($i == 4) {echo '</tr><tr>';}{
?>
<td>
<table border="0">
<tr>
<td align="center" class="picture_border">
<img src="<?php echo htmlentities($imgurl) ?>" /></a></td>
</tr>
<tr>
<td align="center" background="themes/default/images/gradients/003.gif">
<table width="100%" border="0" cellpadding="4" cellspacing="2" class="text_7_css">
<tr>
<td><input type="checkbox" name="uids[]" value="<?php echo $i ?>"/></td>
</tr>
<tr>
<td><?php echo htmlentities($name, ENT_COMPAT,'UTF-8') ?></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<?php
}}
?>
Btw this is not a vbulletin script it does to something else. I have been driving myself crazy on why this won't work lol.
With the code I have so far it does 4 then drops the maining down and does not cont to do 4 then drop down until none are left.
Here is the code can anyone help this noob php learner see the prob ?
<?php
$n = count($contactlist);
for ($i=0; $i<$n; $i++) {
$contact = $contactlist[$i];
$name = $contact->name;
$imgurl = $contact->imgurl;
$uid = $contact->uid;
if ($i == 4) {echo '</tr><tr>';}{
?>
<td>
<table border="0">
<tr>
<td align="center" class="picture_border">
<img src="<?php echo htmlentities($imgurl) ?>" /></a></td>
</tr>
<tr>
<td align="center" background="themes/default/images/gradients/003.gif">
<table width="100%" border="0" cellpadding="4" cellspacing="2" class="text_7_css">
<tr>
<td><input type="checkbox" name="uids[]" value="<?php echo $i ?>"/></td>
</tr>
<tr>
<td><?php echo htmlentities($name, ENT_COMPAT,'UTF-8') ?></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<?php
}}
?>
Btw this is not a vbulletin script it does to something else. I have been driving myself crazy on why this won't work lol.