Re: Inserting the date into MySQL via PHP

From: Date: Wed, 23 May 2001 22:05:18 +0000
Subject: Re: Inserting the date into MySQL via PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-54126@lists.php.net to get a copy of this message
Hello Michael, You hit the nail on the head... Not sure how I missed that... In anycase, thank you. Mike mheumann@sei.cl wrote:
please forgive me if your typo concerns only your posting, but you didn't close your VALUES parenthesis. Then, the order of the data in the second parenthesis doesn't match that in the first one (which it has to). So the correct way to do it would be: $insert = mysql_query("insert into dbrss (Feed, Title, URL, Abstract, Old) VALUES ('$Feed','$Title','$URL','$Abstract',NOW())",$db); Hope this helps. Greetings, Michael.
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
######################################################### # Michael Heumann # S&I Chile - Software e Informatica Limitada # Arlegui 440, Of. 403, Viña del Mar, Chile # Fonofax: (56)(32) 710833 # Email: mheumann@softwareinformatica.cl # Web: http://www.softwareinformatica.cl #########################################################
-- 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

« previous php.general (#54126) next »