Jump to content

[SOLVED] Font Color Based on Value from Database


gamerzfuse

Recommended Posts

To put things simply, I want to change the font color of a value based on the value from the database.

 

Available = 000

Held = 000

Sold = red

 

<?php 
	$vehstatus = $vehicles->status->ViewAttributes();
	if ($vehstatus == "Sold"){$statuscolor="red";}
	if ($vehstatus == "Available"){$statuscolor="000000";}
	if ($vehstatus == "Held"){$statuscolor="000000";}
?>
<tr onMouseover="this.style.backgroundColor='lightblue';" onMouseout="this.style.backgroundColor='transparent';" onclick="document.location='<?php echo $vehicles->ViewUrl() ?>'";
>
<?php if ($vehicles->status->Visible) { // status ?>
	<td<?php echo $vehicles->status->CellAttributes() ?>>
<div<?php echo $vehicles->status->ViewAttributes() ?>><font color="<?php echo $statuscolor ?>"><?php echo $vehicles->status->ListViewValue() ?></div>
</td> 
<?php } ?>

 

Any help would be much appreciated, I know it's not right (the if statement part)

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.