PHP: binary 0 displaying as 1
Posted: Sat May 31, 2014 4:24 pm
Hi
Why is this code returning Yes every time regardless of the value of 'upat3' which could be integer 1 or 0 in my database; regardless if it's a 1 or 0 the PHP code is outputting a Yes and never a No. This is on a MYSQL Linux server by the way.
Why is this code returning Yes every time regardless of the value of 'upat3' which could be integer 1 or 0 in my database; regardless if it's a 1 or 0 the PHP code is outputting a Yes and never a No. This is on a MYSQL Linux server by the way.
Code: Select all
$yesno = (int)$row['upat3'];
if ($yesno = 1) { echo '<td>Yes</td>'; }
if ($yesno = 0) { echo '<td>No</td>'; }