This topic is locked

changing background

2/26/2018 10:06:52 AM
PHPRunner General questions
gehrenfeld author

Why is this not working? It colors all fields with green. I just want the fields that are true. The [have] field is a boolean. So if true(1) want green if false(0) want white.
if ($data["have"] = True)
$record["have_css"].='background:#98FB98';
else
$record["have_css"].='background:white';

Sergey Kornilov admin 2/28/2018

In PHP = is an assignment operator and comparison operator is ==

if ($data["have"] == 1)

$record["have_css"].='background:#98FB98';

else

$record["have_css"].='background:white';