daskemper Posted August 14, 2014 Share Posted August 14, 2014 I am still a novice, but I am working on an idea. I have a table with a field: judges_ccpadv that contains only 3 possible characters = B, R, or N My desire is to display a simple little icon for any of those 3 characters. I tried: if ($data['judges_ccpadv'] = "B") { echo "<img src='images/b.png'>\n";}if ($data['judges_ccpadv'] = "R") { echo "<img src='images/r.png'>\n";}if ($data['judges_ccpadv'] = "N") { echo "<img src='images/n.png'>\n";} The output is any image that is not in the if statement. So if "B" is in field, r.png and n.png are both displayed. What am I doing wrong here? Assistance is greatly appreciated. Thanks! Quote Link to comment Share on other sites More sharing options...
Solution requinix Posted August 14, 2014 Solution Share Posted August 14, 2014 = is for assignment, == is for comparison. Quote Link to comment Share on other sites More sharing options...
daskemper Posted August 14, 2014 Author Share Posted August 14, 2014 Dang it! simple stuff! Thanks a lot! Quote Link to comment Share on other sites More sharing options...
kicken Posted August 14, 2014 Share Posted August 14, 2014 If the image names really are the same as the field letter you could simplify the code to just $letter = strtolower($data['judges_ccpadv']); echo "<img src='images/{$letter}.png'>\n"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.