Inserting the date into MySQL via PHP
| From: | Mike Gifford | Date: | Wed, 23 May 2001 21:32:17 +0000 |
| Subject: | Inserting the date into MySQL via PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-54120@lists.php.net to get a copy of this message | ||
Hello,
This is a really simple (looking) problem, but I can't seem to find the solution in the documentation. I want to insert today's date into a MySQL Date field.
My first attempt was to use the following:
$insert = mysql_query("insert into dbrss (Feed, Title, URL, Abstract, Old) VALUES ('$Feed','$Title','$URL',NOW(),'",$db);
The relevant table was created with the following:
CREATE TABLE dbrss (
ID int(7) NOT NULL auto_increment,
Feed varchar(50) NOT NULL,
Title varchar(255) NOT NULL,
URL varchar(255) NOT NULL,
Abstract varchar(255),
superRSS varchar(50),
Type varchar(50),
Old date,
Source varchar(100),
SourceURL varchar(100),
PRIMARY KEY (ID)
);
I also tried to insert a date generated by:
$Date = date(Y-m-d);
using the following variation:
$insert = mysql_query("insert into dbrss (Feed, Title, URL, Abstract, Old) VALUES ('$Feed','$Title','$URL','$Date','",$db);
Any help would be appreciated.
Mike
--
Mike Gifford, OpenConcept Consulting, http://openconcept.ca
Offering everything your organization needs for an effective web site.
Featured Client: http://halifaxinitiative.org
A good life is one inspired by love and guided by knowledge - B. Russell