have a mysql query that orders entry by complaint category.
this query is then used with mysql_fetch_array to generate table of records ordered by complaint and other parameters.
i can alter color for every even and odd row but how can i alter row color based on each specific 'ORDER BY' mysql query?
so how can i change color for every unique order of
Expand|Select|Wrap|Line Numbers
- $stat_rec['complaint'].
[PHP]$sql=("SELECT a.month, b.location, c.complaint, d.source, e.number, f.stat_id, g.year
FROM month a, location b, complaint c, source d, stat e, stat f, year g
WHERE ('$_POST[m_id]' = e.m_id OR '$_POST[m_id]' = '')
AND ('$_POST[l_id]' = e.l_id OR '$_POST[l_id]' = '')
AND a.id_month = e.m_id
AND b.id_location = e.l_id
AND d.id_source = e.s_id
AND c.id_complaint = e.c_id
AND f.stat_id = e.stat_id
AND g.id_year = e.y_id
AND '$_POST[y_id]' = e.y_id
ORDER BY month,location,complaint,source") or die (mysql_error()) ;
IF (!mysql_query($sql,$con)) {die('Error: ' . mysql_error());}
//initializing extraction of customer stat
$CustomerStat = mysql_query($sql) or die (mysql_error());
[/PHP]
[PHP]while ($stat_rec= mysql_fetch_array($CustomerStat))
{ echo "<tr><td><a href=stat.php?stat_id=".$stat_rec['stat_id']."><p style = 'font-size:xx-small;'>".$stat_rec['stat_id']."</p></td>";
echo "<td>".$counter."</td>";
echo "<td>".$stat_rec['year']."</td>";
echo "<td>".$stat_rec['month']."</td>";
echo "<td>".$stat_rec['location']."</td>"; echo "<td>".$stat_rec['complaint']."</td>"; echo "<td>".$stat_rec['source']."</td>";
echo "<td>".$stat_rec['number']."</td></tr>";[/PHP]