php - condition in SELECT command -
i have user table fields username,student name, class stores values
username studentname class -------- ----------- ------ abc prudhvi 1 xyz vishwa 2 sss priya 3
i'm displaying database records user table using grid table.
select * user.
now, here if class=1 want display class name in grid nursery & if class=2 should display pre-school....
i want displaying grid table follows
username studentname class -------- ----------- ------ abc prudhvi nursery xyz vishwa pre-school sss priya kindergarten
but want display class names differently while displaying without changing it's values in database.
i tried using switch codition,but didn't worked.
please me.
easiest way make second table contains class mappings:
id|class 1 |nursery 2 |preschool ...
then join first table on new classtable , select values need.
Comments
Post a Comment