Jump to content

some syntax help


BillyBoB

Recommended Posts

i am build a cs based website for a clan but i was wondering how would i do this

[code]
while($rinfo=mysql_fetch_array($rsql)&&$i!=0) {
if($i==4) {
echo("
</tr>
<tr>
");
}
if($i==8) {
echo("
<tr>
");
}
echo("
<td width=\"45px\" height=\"64px\">
<center>
<a href=\"members.php?id=$rinfo[membersid]\"><img src=\"roster/$rinfo[pic]\" width=\"35px\" height=\"40px\" title=\"$rinfo[name]\"/></a>
</center>
</td>
");
if($i==1) {
echo("
</tr>
");
}
$i--;
}
[/code]

$i is declared in the earlier script but it shows how many ppl are on the roster
and im trying to do somin like if $i != 0 then keep going but if it equals 0 then stop
but as of now im getting nothing showing up
Link to comment
https://forums.phpfreaks.com/topic/35075-some-syntax-help/
Share on other sites

I remember PHP being fussy about bracketing.  The following may help (but may not).  You may want to use an or || instead also.
while(($rinfo=mysql_fetch_array($rsql))&&($i!=0)) {

You could just change it to...
while($rinfo=mysql_fetch_array($rsql)) {

Then just put...
if ( $i < 1 ) break;

...in at the end to cause it to exit the while loop as the first example will only stop if both $i=0 and it's run out of queries for mysql_fetch_array.

Link to comment
https://forums.phpfreaks.com/topic/35075-some-syntax-help/#findComment-165525
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.