0

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

3
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

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.

0

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!

0
<?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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.