kurtis Posted August 3, 2006 Share Posted August 3, 2006 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 Quote Link to comment Share on other sites More sharing options...
shoz Posted August 3, 2006 Share Posted August 3, 2006 what's the query that's giving this error? Post the relevant code snippet as well. Quote Link to comment Share on other sites More sharing options...
kurtis Posted August 3, 2006 Author Share Posted August 3, 2006 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] Quote Link to comment Share on other sites More sharing options...
fenway Posted August 3, 2006 Share Posted August 3, 2006 Yeah, that makes no sense... those aren't values -- string literals -- they're field names. And where is the column list? I'm confused, and so is the parser. Quote Link to comment Share on other sites More sharing options...
kurtis Posted August 3, 2006 Author Share Posted August 3, 2006 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] Quote Link to comment Share on other sites More sharing options...
fenway Posted August 3, 2006 Share Posted August 3, 2006 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] Quote Link to comment Share on other sites More sharing options...
kurtis Posted August 3, 2006 Author Share Posted August 3, 2006 thanks for your help :D but now it says unexpected t_string :( its not my lucky day! lol Quote Link to comment Share on other sites More sharing options...
king arthur Posted August 3, 2006 Share Posted August 3, 2006 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] Quote Link to comment Share on other sites More sharing options...
fenway Posted August 4, 2006 Share Posted August 4, 2006 But of course... my bad. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.