Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing Two Dates 1

Status
Not open for further replies.

pastorandy

IS-IT--Management
Nov 2, 2006
84
GB
Hi

I am trying to compare two different DATE fields from a mysql DB. The two fields are DATE and not DATETIME.

Here's my query
Code:
$query6 = "SELECT * from holiday WHERE installer_id = 1 AND holiday_date = $row4[job_date]";

But I am not getting the expected results. If I output the two DATE variables they are the same but i'm not sure my comparison is correct.
 
Since MySQL is going to want the date strings in the form YYYY-MM-DD, you're going to have to surround the dates with singlequotes. Otherwise, MySQL is going to treat your date string as a math problem.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top