RE: [PHP] adding the date to a database
| From: | Don Read | Date: | Wed, 18 Jul 2001 19:59:19 +0000 |
| Subject: | RE: [PHP] adding the date to a database | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58533@lists.php.net to get a copy of this message | ||
On 18-Jul-2001 Brad Wright wrote:
> Hi,
> I have a database with a 'date' field. What is the syntax for using the
> (mysql) function 'getdate()', to insert the date into the DB table.
> the syntax I'm currently using is:
> $query = "Insert INTO visits (visName, date)
> values ('$name', getdate()) " ;
> $result = mysql_query($query, $db);
>
> This does not work (but returns no errors) ie, nothing inserted into the
> database.
>
did you test $result ?
It's usually helpful to check the manual when you're not sure of the syntax
for MySQL you can use NOW() , CURDATE(), or CURRENT_DATE.
--
Don Read dread@texas.net
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.