Re: What wrong with my Query??

From: Date: Sat, 26 Mar 2005 12:01:00 +0000
Subject: Re: What wrong with my Query??
Groups: php.db 
Request: Send a blank email to php-db+get-39042@lists.php.net to get a copy of this message
There you have to consider the following things; 1, the query is mixed with INSERT and UPDATE staments 2, id is a numeric data type field, so the value should be mentioned in numeric form (instead of string) 3, LIMIT is a keyword of SQL statement 4, lastip field is a string datatype, so the value should be mentioned in string form 5, if the query is just for insertion of a new record, there might be no need to specify value for id field as it is an auto_increment field R. Kumaran India : -----Original Message----- : From: HarryG [mailto:harry1980@gmail.com] : Sent: Thursday, March 24, 2005 11:27 PM : To: php-db@lists.php.net : Subject: [PHP-DB] What wrong with my Query?? : : : What the hell is wrong with this MYSQL query?? PHP keeps giving me the : error message: : : You have an error in your SQL syntax. Check the manual that corresponds : to your MySQL server version for the right syntax to use near : 'limit=20000, name='test1', email='atest@test.com', password='t : : $query = "INSERT INTO mfadmin SET id='', account='$accname_lc', : limit=$plans, name='$yourname', email='$email', password='$password', : lastlogin='$datetoday', datecreated='$datetoday', expiry='$expirydate', : lastip=123.123.123.123"; : : This is my table structure : CREATE TABLE admin ( : id int(10) unsigned NOT NULL auto_increment, : account varchar(50) NOT NULL default '', : limit int(10) unsigned NOT NULL default '0', : name varchar(50) NOT NULL default '', : email varchar(50) NOT NULL default '', : password varchar(50) NOT NULL default '', : lastlogin varchar(50) NOT NULL default '', : datecreated varchar(50) NOT NULL default '', : expiry varchar(50) NOT NULL default '', : lastip varchar(50) NOT NULL default '', : PRIMARY KEY (id) : ) TYPE=MyISAM; :

« previous php.db (#39042) next »