hi,
i am trying to output from a database and because of my slightly odd HTML code in that i have a table with three cells and a table in each of those cells i need to use either three WHILE or FOR statements one after another which PHP doesn't seem to like as it does the first one and then finishes, is this because they ahve the same condition??
here's my code:
<?
$i = "0";
for ($i; $i < $number2; $i++) {
$name = mysql_result($result2,$i,"name");
$clan = mysql_result($result2,$i,"clan");
PRINT "<tr>\n<td width=\"100%\" class=\"newstext\">$clan$name\n</td>\n</tr>\n";
}
?>
</table>
</center></div></td>
<td width="14%" class="newstext"><div align="center"><center><table border="0"
cellpadding="0" cellspacing="0" width="100%">
<?
for ($i; $i < $number2; $i++) {
$status = mysql_result($result2,$i,"status");
PRINT "<tr>\n<td width=\"100%\" class=\"newstext\">$status</td>\n</tr>\n";
}
?>
</table>
</center></div></td>
<td width="25%" class="newstext"><div align="center"><center><table border="0"
cellpadding="0" cellspacing="0" width="100%">
<?
for ($i; $i < $number2; $i++) {
$name = mysql_result($result2,$i,"name");
$clan = mysql_result($result2,$i,"clan");
PRINT "<tr>\n<td width=\"100%\"><a href=\"memberlist.php3?id=$clan$name\" class=\"darklink\" title=\"$clan$name's profile\">member profile</a></td>\n</tr>\n";
}
?>
</table>
</center></div></td>
</tr>
</table>
</center></div>
<?
include "footer.php3";
?>
I have multiple values in each field and i need each FOR statement to execute for each value, hence $i++.
Moving the end of statement brackets around allows it to print one value for name and status and all for the member profile link this is when the close bracket for the first two is just before the include command at the end of the code.
Please help me as this is driving me nuts, i'm only a newbie to PHP aswell!