-2

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";
      }
?>
Cœur
  • 37,241
  • 25
  • 195
  • 267
dennis
  • 39
  • 6

1 Answers1

0

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

variable = "test"

Double == is for comparing

1 == 1 // True

Oisin
  • 770
  • 8
  • 22