Hi.
Fairly new to PHP - coming from a fairly fluent Classic ASP VBScript background.
-
PHP 5.x
-
Have a MySQL db
-
Have a [sale_status] column (Values are either “E” or “P” – For “Expired” or “Pending”, respectively).
-
Looping through the [sale_status] column to display the statuses - works fine.
-
I am trying to do a basic “If statement” where it will do one thing for “E” and another for whatever else.
-
The statement asks:
if {{sale_status}} == “E” {
echo (“YES”);
}
ELSE {
echo (“NO”);
}
-
I only get “NO” for ALL the records - including the “E” records.
-
I know the {{sale_status}} is giving the correct data through the loop, because I removed the “if statement” and just “echoed” the {{sale_status}} and it outputs the correct respective values going down the page.
-
I have tried “===” and “==”, but same thing.
-
I got a little something when I did a “strcmp” or “strcasecmp”, but they were inconsistent.
-
Verified it is a type “varchar(50)” field in the MySQL db.
In Classic ASP, it would compare without an issue, but I know PHP has some different nuances that I have yet to learn regarding comparisons, and such.
If anyone could, please, help - that would be great.
Thank you!
Shane