I am new to MySQL an PHP and not sure how to do this.
I am displaying:
<?php echo "$cash"; ?>
on my page. Which works just fine.
What I would like to do is, if it is a negative number I would like the number to be red if it is a positive number I would like the number to be green the font color that is.
Any help would be appreciated, thank you.
<?php $class = ($cash < 0) ? 'red' : 'green' ?>
<p class="<?php echo $class; ?>"> <?php echo $cash; ?> </p>
<style>
.red { color: red }
.green { color: green }
</style>
this works, but i would like the '$' to be included. Example:
-$100
$100