I’m trying to get a boolean which if equals 1, an image is inserted.
I viewed a tutorial, and made this as a starter to test if it works:
AND IF(IF_DRAFT_BEER = '1', 5, 2) = 1
I tried to say that if IF_DRAFT_BEER = 1, then set the value to 5, otherwise 2. If that worked, I would try implementing the images.
I printed it this way:
$row['IF_DRAFT_BEER']
However after inserting the and if clause, none of the rows are showing anymore.
Anyone know why this happens? Thanks! 🙂
Well, your line;
will basically give the result
5or2, then compare it to1. Since neither5or2is equal to1, the comparison will never be true and the query won’t return any rows.I’m not quite sure why you’d have this kind of calculation in a
whereclause though, I suspect you’ll want to move your calculation up to the select and actually get it as a result, a’la;That way it will show up in your result
$row.