RE: [PHP] Setting date fields in mysql queries
| From: | Jay Blanchard | Date: | Wed, 02 Oct 2002 19:21:27 +0000 |
| Subject: | RE: [PHP] Setting date fields in mysql queries | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-118639@lists.php.net to get a copy of this message | ||
[snip]
I have the following line in a program I'm working on:
$query = "UPDATE countertable SET CurrDate = '$ndate' WHERE ID = $id"
$ndate is a properly formated date read from a text field on a form on
the previous page. When I run the query using mysql_query, it returns
TRUE each time, but the field is not updated. The only explanation I
can think of is that there is something wrong with the date value. I've
echoed it to the screen and it looks fine, but the query still doesn't
work. Any suggestions?
[/snip]
Are you actually running the query somehow? Like with mysql_query()? Since
you didn't deliver more code it this is the guess I would take.
$query = "UPDATE countertable SET CurrDate = '$ndate' WHERE ID = $id" ;
// do some error checking
if(!($data = mysql_query($query, $your_bd_connection))){
print("MySQL reports: " . mysql_error() . "\n");
exit();
}
HTH!
Jay