Forum Moderators: open
Database connection is working fine (I can run SELECTs with no trouble), so I don't think it's that.
Here's the code:
$query = "INSERT INTO users
(userid, username, password, name, regdate, email, website, location, show_email, last_login, desc)
VALUES
(NULL,'goddwalk','pa55word', 'Test User', '20061104', 'user@test.com', 'www.test.com', 'Dublin', '0', '20061104', 'Woof woof, man')"; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); Any ideas?
... and here's the returned error:
Query failed: 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 'desc) VALUES (NULL,'goddwalk','pa55word', 'Test User', '20061104', 'user@test.' at line 2
(NULL,'goddwalk','pa55word', 'Test User', '20061104', 'user@test.com', 'www.test.com', 'Dublin', '0', '20061104', 'Woof woof, man')";
you are inserting NULL value into userid. so if your userid field is integer you need to insert integer value not a null.
[edited by: Mohamed at 6:59 pm (utc) on Nov. 4, 2006]