Jump to content

simple toggle php script?


delphi123

Recommended Posts

Ok,

 

I've got a script that's producing rows of a table like this:

<?php 
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$percent = $row['rating_overall']*10;
echo '<tr><td>'.$row['software_name'].'</td><td>'.$percent.'%</td></tr>';
}
?>

 

Now I want the rows to alternate,  I was going to create a variable and have two big if statements (ie if variable = 0 then do one which finishes setting it to 1 and then have another loop for the reverse...

 

but then I reckoned one of you guys would have some really clever and intuitive way that I might be able to learn from...  ;D ;D ;D

 

Any tips!?

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.