Solved

What is the correct code for this if statement?

Posted on 2011-09-05
4
275 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
  • 2
4 Comments
 
LVL 30

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now