Select Logic and Dates

I have a database the lists jobs, their start dates, admin dates, production dates, ship date and finish date. My webpage display the job name, start date and then the status of the next 5 days. If the data is between start and production then its in Admin stage, between production and before ship date, then in production stage and so on.

It looks like it is working but not all the status is wrong. The logic in the Select looks correct but it is just not working. If i change the select to be (true) which I think it should be then it totally messes it up. I thought I had all the dates formatted the same way but not sure if this is throwing my logic out. I just can't figure it out. Any help appreciated.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The dates in your table are mm/dd/yyyy but the dates are displayed as dd/mm/yyyy so I'm guessing that you are doing conversions in your code.

I don't know PHP but if $ indicates a string, you need to change your date format to yyyy/mm/dd

When you compare string dates, they are compared as strings.  Character by character, left to right.  So
10/30/2018 is LESS THAN 12/31/2017 because 10 is less than 12.

NEVER convert dates to strings if you need to use them for calculation or sorting.  If you must convert them to strings for those purposes because you are building embedded SQL, then you must use yyyy/mm/dd format to give year precedence over month and month precedence over day.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.