Home > Blockchain >  Php How To Echo Null from MySql
Php How To Echo Null from MySql

Time:09-02

I have the following script that I use for part of my count in payment_status from Mysql. I have seen some examples of this online, but I can't seem to figure out how to make this work WITH a Null instance. Any insight would be appreciated.

Note: The way I have it now doesn't work when Null is in the database. I'm guessing because that isn't an inserted word?

Objective: To add $row['payment_status'] == "Null" to this with the rest of the script.

if($row['payment_status'] == "Completed" || $row['payment_status'] == "Free" || $row['payment_status'] == "Cancelled" || $row['payment_status'] == "Null")

CodePudding user response:

if payment_status column has default value NULL, Then try below change

if($row['payment_status'] == "Completed" || $row['payment_status'] == "Free" || $row['payment_status'] == "Cancelled" || $row['payment_status'] == null)
  • Related