I have searched endlessly for the following. What I am trying to do is simple. I have in an sql table. From an entry of this table, if for example this entry is "check", then I want to output an image of a checkmark sign so that the user will see a checkmark image as opposed to the word check. How can I do this in php? I thought that I could simply use the <img src tag from html, but php complains. Thank you.
Hello. I tried what you suggested, but php gives me an error complaining that it does not recognize <. I had this error earlier and I am assuming it is because "<" is an html tag, not recognized by php.
SELECT IF(myColumn1 = 'check', './images/myImage.jpg', './images/noImage.jpg') AS image FROM mytable Code (markup): ...And then after you've done all your mysql_query() and mysql_fetch_assoc() stuff. Echo it out as the following: <?php echo '<img src="' . $aRow['image'] . '" />'; ?> PHP: Where $aRow is the array that contains the data from mysql_fetch_assoc()