I'm having the table
In this table having column names
SQL query:
SELECT order_no FROM sales_orders where order_status='Pending' and order_type='1'
In the above query if the order_type=1
value doesn't exists in the database column that means instead of value 1 there is a value '0' , I want to display an error.
How to modify the above query for that?
If I understand correctly, you want to show an error if order_type is not equal to 1. If so, you can do something like this:
$query = "SELECT order_no FROM sales_orders where order_status='Pending' and order_type = 1";
if ($result = $mysqli->query($query)) {
while ($row = $result->fetch_object()) {
if ($row->order_type != 1) {
printf('There is no rail order for order number %d', $row->order_no);
}
}
$result->close();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With