Hi I have a html page with a div and i'm loading data into it every 10 seconds (using jQuery load().) from a php page which is querying a mysql db.

This is great but what i want to do is if a value in the table i'm loading into the div goes above/below a pre-determined setpoint then i need that whole row to highlight red/green etc. Would i use something like jQuery for this ie. table striping but adapted. or could i just do it in PHP ie. if temp > 50 then highlight row red?

Any ideas?

Thanks

If you're constantly refreshing data with jQuery, you'd probably need jQuery to change the row colors. I'm no jQuery expert, but you could probably use some of the advanced jQuery selectors to accomplish this. :gt() in particular may come in handy. You should be able to use this to add a CSS class to all items after a certain point.

That sound like something i needs, thanks alot!

I've tried it and its quite fiddly but i'll have a play around with it!

Good luck! Make sure to mark the thread as solved if you've found your solution :)

<?php
while($rows=mysql_fetch_array($result))
{
	$style = '';
	if($rows['designation']=="Teamleader")
		$style = 'style="color:#0000FF;"';
	if($rows['designation']=="Manager")
		$style = 'style="color:#cc0000;"';
	
echo "<option value=".$rows['username']." ".$style.">".$rows['username']."</option>";
}
?>

you can set the style option just like above sample for your rows.