I have a field in my db called 'code' which has values A, B, and C.
I want to output this as:
If code == A
then output Apples
If code == B
then output Bananas
and so on.
I've tried this and it works for a single value but no more:
$query = mysql_query("SELECT color, size, REPLACE(code,'A','Apple') AS real_code FROM products
Does anyone know how I can do thing:
$query = mysql_query("SELECT color, size, REPLACE(code,'A','Apple',code,'B','Banana') AS real_code FROM products
When I do this one it errors out on me.
What's the easiest way to do this without changing the values in the db?
thanks
chad