If Else


I am trying to display a message if my invoice is paid or not

in my database if status =0 then its unpaid if its 1 then its paid;

i tried this but does not work tried variations but i’m not that code literate.

<?php if ($invoice['invoice_completed'] == "0") { echo "Unpaid"; } else { echo"Paid" } ?>

also tried

<?php if ($invoice['invoice_completed'] == "0") { echo "Unpaid"; } elseif ($invoice['invoice_completed'] == "1"){ echo"Paid" } ?>


You are missing semi-colons. If you turned on error reporting PHP would tell you. If you properly formatted your code you probably would have seen it.

Sponsor our Newsletter | Privacy Policy | Terms of Service