Re: MySQL Date insert

From: Date: Mon, 28 Jul 2003 18:26:31 +0000
Subject: Re: MySQL Date insert
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-29521@lists.php.net to get a copy of this message
From: "Andrew D. Luebke" <andrew@copeandmcphetres.com> > $date = date("Y-m-d H:i:s"); > $result = mysql_query("INSERT INTO Boats (Make, Model, Serial, > Stock, Extension, Cust_Name, Store, Date) VALUES > ('$make', '$model', '$serial', > '$stock', '$extension', > '$name', '$store', '$date'") > or die("Invalid query: " . mysql_error() . "</body></html>"); > > The problem is with the Date column. It is of type DATETIME. I get an > error on the second line of the insert statement. I assume I'm not putting > formatting the date-time variable correctly but I've tried everything I can > think of, so any help is very much appreciated. Thanks. Like someone else said, using Date as a column name probably isn't very smart. Your problem is caused by not having a closing parenthesis in your query, though. '$date')") ---John Holmes...

« previous php.db (#29521) next »