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
https://forums.phpfreaks.com/topic/81257-simple-toggle-php-script/
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.