Hello , the problem is simple but i can't find the solution.
The db items : name , age , bool ( bool being a bool ).
The php code :
<? // Connect to db
$result = mysql_query("SELECT * FROM db");
$count = mysql_num_rows($result);
if($count >= 1)
{
while ($row = mysql_fetch_array($result))
{
echo $row['name'];
echo $row['age'];
echo $row['bool'];
}
}
mysql_close($con);
Now instead of displaying zeros and ones for the BOOL , i want to display an image , if the bool is 1 a check img and if the bool is 0 an x img as in 'Passed' and 'Failed'.
I tryed adding the following code in the while loop :
if ($row['bool'] = 1) { $bool = <img check bla bla>; }
else { $bool = <img x bla bla>; }
and replaced $row['bool'] with $bool in the loop.But it just changes all the values for $bool with the check image ignoring the '0' values.
Can anyone help ?