Solved

What is the correct code for this if statement?

Posted on 2011-09-05
4
292 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 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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

770 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