adding conditional color formatting to MYSQL queries on website

I have some MYSQL queries that pull week over week sales comparisons. One of them returns a number with a $ added in the query and the other returns a percentage with the % added in the query as well. Both queries display their results on a website. They are NOT on a spreadsheet or table. The numbers are dynamic meaning that one week it could be positive, the next week it could be negative. MYSQL does all the math and returns the result.

I want to add up/arrows on the website and have the entire number with the arrow turn green or red like this depending on if its a positive or negative number. I am unsure if its better to go about this via JS or PHP. Can some folks guide me on which is better AND how I would accomplish this? Thanks.

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.