You are confusing =
with ==
.
You want
if ($ship_status=="Shipped")
One equals sign is an assignment. Two is a comparison.
Reference: http://php.net/manual/en/language.operators.comparison.php
Question
I am trying to make something appear if the status of the order is "shipped"
I have created the following trying to get it to show only if the status
$ship_status = $orders->fields['orders_status_name'];
if ($ship_status="Shipped")
{
echo "Shipped Out";
}
When I echo $orders->fields['orders_status_name']
I get
Update
Update
Printing
Deleted
Shipped
Shipped
Update
Shipped
Shipped
Shipped
Shipped
Shipped
Shipped
so if I was to place that next to the if statement I should get "Shipped Out" next to those that are "Shipped" ... But i get "Shipped Out" next to EVERY one!
So I do not know what to do now! Any help would be GREAT!
Thanks in advance!
Solution
You are confusing =
with ==
.
You want
if ($ship_status=="Shipped")
One equals sign is an assignment. Two is a comparison.
Reference: http://php.net/manual/en/language.operators.comparison.php