Jump to content

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.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.