Jump to content

You have an error in your SQL syntax.......


kurtis

Recommended Posts

yes its the annoying "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 '' at line 1" error!
im follwing the user system tutorial but made my own registration page becuase i couldnt get the other one working so i made my own which seems to promise more but i still get this error and i dont know why  ???
anyone got any ideas?
thanks
Link to comment
Share on other sites

db.php:
[code]
<?
$link = mysql_CONNECT(localhost,root);
mysql_select_db(dijeridooo);
if (!$link) {
die('could not connect:' . mysql_error());
}
echo 'connection succesful';
?>
[/code]
(i added the echo just to make sure it was connecting)

registration file:
[code]
$query = mysql_query('INSERT INTO users VALUES(id, username, encryptpass, password, name, prov, style, hist, infl, open, webs, email, photo, signupdate') or die (mysql_error());
[/code]
Link to comment
Share on other sites

ye i thought that :S i rote it originally i had a few errors so i asked my mate for advice(hes been doing it longer than me) n he just messed round with the connection till it came up with this error and the he didnt know what to do :S this is the one i had before:
[code]
$query = mysql_query('INSERT INTO users VALUES(id=$id, username=$username, encryptpass=$encryptpass, password=$password, name=$name, prov=$prov, style=$style, hist=$hist, infl=$infl, open=$open, webs=$webs, email=$email, signupdate=now()') or die (mysql_error());
[/code]
Link to comment
Share on other sites

While you can use a variation of the UPDATE syntax for inserts, I prefer to use the more conventional approach:

[code]
$query = mysql_query('INSERT INTO users (id, username, encryptpass, password, name, prov, style, hist, infl, open, webs, email, photo, signupdate ) VALUES('$id', '$username', '$encryptpass', '$password', '$name', '$prov', '$style', '$hist', '$infl', '$open', '$webs', '$email', now()) or die (mysql_error());
[/code]

Link to comment
Share on other sites

What Fenway meant of course was

[code]
$query = mysql_query("INSERT INTO users (id, username, encryptpass, password, name, prov, style, hist, infl, open, webs, email, photo, signupdate ) VALUES('$id', '$username', '$encryptpass', '$password', '$name', '$prov', '$style', '$hist', '$infl', '$open', '$webs', '$email', now()") or die (mysql_error());
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.