Jump to content

changing row color


brown2005

Recommended Posts

Hi there,
There are several ways for doing this...for example; you can do sothing like this:
[code]$counter = 0;
$result    = 0;
$color    = ' ';
while(....){
  $result = $counter % 2;
  if($result == 0){
      $color = 'red';
  }elseif($result == 1){
      $color = 'blue';
  }
  $counter++;
}[/code]
Link to comment
https://forums.phpfreaks.com/topic/34220-changing-row-color/#findComment-160983
Share on other sites

$profile = "SELECT * FROM table A;";
$profile_query = mysql_query($profile) or die(mysql_error());
     
$current_price = "";

while($row = mysql_fetch_array($profile_query, MYSQL_ASSOC))
{

    if($row['month'] != $current_price)
    {

echo"<tr>
          <th colspan='4'>".$row['month']."</th>
        </tr>";

    $current_price = $row['month'];

    }

echo"<tr>
  <td>".$row['position']."</td>
  <td>".$row['name']."</td>
  <td>".$row['hits']."</td>
  </tr>";

   
}

Hi, sorry this is what i have currently.. wat i want is for the first row to be class='a' and second row to be class='2', and so on.

how can i work this into the code above, please...
Link to comment
https://forums.phpfreaks.com/topic/34220-changing-row-color/#findComment-161061
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.