Jump to content

PHP & mySQL syntax problem


TapeGun007

Recommended Posts

I posted in here, because I know the SQL is correct.

 

When I do this in phpMyAdmin, this works great:

Update Leads SET FollowUpDate='2011-08-18' WHERE FollowUpDate<'2011-08-18'

 

But in PHP I have the code written (and I've tried several different ways):

 

$TodaysDate = date("Y.m.d");
$statement="Update Leads SET FollowUpDate='$TodaysDate' WHERE FollowUpDate<'$TodaysDate'";

 

When I execute the SQL above, it actually resets all the dates to 0000-00-00... ug.  What is the correct syntax?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/245125-php-mysql-syntax-problem/
Share on other sites

Yes, you are correct.  However, now it simply does not update anything.

 

Also, I did a

echo $statement;

 

And I get this:

Update Leads SET FollowUpDate='2011-08-18' WHERE FollowUpDate<'2011-08-18'

 

I purposely changed one date in phpMyAdmin to 2011-08-17, and it's not updating that record to 2011-08-18.  Yet that nearly same command works fine in the SQL area of phpMyAdmin.  So I am confused, must be improper syntax.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.