Not sure what this error is...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Not sure what this error is...

Post by thefreebielife »

Code: Select all

Could not insert data because 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 's)' at line 1
I don't know what it means by "s)"

Any suggestions?
User avatar
idevlin
Forum Commoner
Posts: 78
Joined: Tue Jun 26, 2007 1:10 pm
Location: Cambridge, UK

Post by idevlin »

Show us your SQL statement and we might be able to help.
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

Code: Select all

//if not insert data
if ($error == "none") { 
$insert = mysql_query("insert into users values ('$username', '$pass2', '$fname', '$phone', '$Email', '$address', '$city', '$state', '$zip', '$country', '$ip', '$date's)")
or die("Could not insert data because ".mysql_error());
echo '<center><font color="#ff0000"><h4>Thank You, Your Account Has Been Created</h4>'; 
if ($error == "none") {
echo '<meta http-equiv="refresh" content="3;url=login.php">';
   exit;
   }
}
User avatar
idevlin
Forum Commoner
Posts: 78
Joined: Tue Jun 26, 2007 1:10 pm
Location: Cambridge, UK

Post by idevlin »

Code: Select all

'$date's)") 
You can't have punctuation in a data field. Rename it to $dates.
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

thanks, stupid mistake.
User avatar
idevlin
Forum Commoner
Posts: 78
Joined: Tue Jun 26, 2007 1:10 pm
Location: Cambridge, UK

Post by idevlin »

thefreebielife wrote:thanks, stupid mistake.
No worries! Happens everyone!
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Not sure what this error is...

Post by superdezign »

thefreebielife wrote:

Code: Select all

Could not insert data because 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 's)' at line 1
Hehe, never noticed how many keywords SQL has. :-P
Post Reply