Solved

What is the correct code for this if statement?

Posted on 2011-09-05
4
307 Views
Last Modified: 2012-05-12
Here's the if statemement that I'm using:

if($email_sent<>"0000-00-00")
{
do something
}
else
{
do another thing
}

It's not working correctly and I don't know why. When I print out the $email_sent variable, it comes back "0000-00-00." Yet, it just blows right past my if statement.

So, what do I need to do different? I need to write an if statement that effectively identifies those situations where the date field is 0000-00-00. Right now, what I have written isn't doing that and I don't know why.

Thoughts?
0
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 400 total points
ID: 36484330
Use != instead <>:

if($email_sent != "0000-00-00")
{
do something
}
else
{
do another thing
}
0
 
LVL 4

Assisted Solution

by:Daelt
Daelt earned 100 total points
ID: 36484369
not sure about the <> supported by php.

Maybe have a try with this :
if($email_sent != "0000-00-00")
{
do something
}
else
{
do another thing
}

Open in new window

0
 
LVL 4

Expert Comment

by:Daelt
ID: 36484371
lol MarqusG was a bit quicker to answer ;)

Hope it works anyway
0
 

Author Comment

by:brucegust
ID: 36484687
Thanks, guys!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question