In a table in my database, I have a column that stores status values for posts. So if a post is published, it's 0, draft = 1, if it's yet to be looked at by a moderator - it's 2, if it's deleted - it's 3
So table looks like:
postid | status
----------------
1 0
2 1
3 2
I need to display an icon for each post based on it's status. Can I do something like this in a sql query itself instead of writing more php code:
Eg:
select postid as pId, status as status (if status = 0 {status = '<img src="published.png"'} elseif if status =1 {status = '<img src="draft.png"'}
I hope you got the idea. (The above sql statement is just for example) Can something like this be done.