dennis dennis - 28 days ago 6
PHP Question

php Using if is not changing?

If the

$status
=
pending
or
success
the result is always warning. How is that possible? Am I using the
else
right? Maybe someone can help me with it. The
$status
is coming from a database. Can you explain whats the difference between
=
and
==
?

Thanks sincerely Dennis

<?php if ($status == "pending") {
$class ="warning";
} else if ($status == "succes"){
$class = "succes";
}
?>

Answer Source

To answer your 2nd Question:
A single = is for asigning a value to a variable.

variable = "test"

Double == is for comparing

1 == 1 // True