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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.