The values for the A,b,time three fields are now removed from the database x table.
If the value of a in the query results is xiaoming, the background color is #96 and the font color is white.
You now need to add a condition that if time (type DateTime) is the closest you have now, the font for all the fields in that row is changed to red.
How do I set up $time_style.
At the same time meet the above two conditions.
The following code satisfies the first condition:
$sql = "Select A,b,time from X";
$rst = mysql_query ($sql);
while ($row =mysql_fetch_assoc ($rst)) {
$VIP _style = $row [' A ']== "Xiao Ming"? ' style= ' background-color: #096; color:white; "': ';
echo "{$row [' a ']}{$row [' B ']}{$row [' Time ']}";}
Reply to discussion (solution)
You can $sql = "Select A,b,time from X order by time Desc;
Take the first piece of data; If this data satisfies a== xiaoming, it turns red. That would not satisfy two conditions.
You must calculate the time difference before you know who is the smallest
You want to do it over and over again, you can't do it.
You can $sql = "Select A,b,time from X order by time Desc;
Take the first piece of data; If this data satisfies a== xiaoming, it turns red. That would not satisfy two conditions.
How to take it?
You must calculate the time difference before you know who is the smallest
You want to do it over and over again, you can't do it.
Or how do I take the maximum time value for all the fields in that row for the style setting?
You can $sql = "Select A,b,time from X order by time Desc;
Take the first piece of data; If this data satisfies a== xiaoming, it turns red. That would not satisfy two conditions.
How to take it?
$row =mysql_fetch_row[$sql];
You can $sql = "Select A,b,time from X order by time Desc;
Take the first piece of data; If this data satisfies a== xiaoming, it turns red. That would not satisfy two conditions.
How to take it?
$row =mysql_fetch_row[$sql];
You can $sql = "Select A,b,time from X order by time Desc;
Take the first piece of data; If this data satisfies a== xiaoming, it turns red. That would not satisfy two conditions.
How to take it?
$row =mysql_fetch_row[$sql];
Sorry, it should be.
$result =mysql_query ($sql);
$row =mysql_fetch_row[$result];