Link to home
Create AccountLog in
Avatar of Terry Rogers
Terry RogersFlag for United Kingdom of Great Britain and Northern Ireland

asked on

MySQL Format Results

I am retrieving data from a table, one column of which is gender and this is stored as either M or F, how can I in a mysql select query return Female if the value is F and Male if the value is M?
Avatar of ehabafia
ehabafia
Flag of Saudi Arabia image

you will retrieve it from the MySQL and after that you will use the folloing:

$gender = ($row['gender'] == 'M')? "Male":"Female";

echo $gender;
ASKER CERTIFIED SOLUTION
Avatar of ncoo
ncoo

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Terry Rogers

ASKER

Perfect, Thanks!