rhyspaterson Posted July 9, 2007 Share Posted July 9, 2007 Hey guys, Receiving the following syntax error: Warning: pg_exec() [function.pg-exec]: Query failed: ERROR: syntax error at or near "user" LINE 1: UPDATE user SET name = 'Joe Blogs', password = 'ck2007' ... ^ in /var/www/menu/client/form/process.php on line 435 The command being used is: $result = pg_exec($dbconn, "UPDATE user SET name = '$username', password = '$userPassword' WHERE id = '$userID'"); All the variables are fine, just not sure what's wrong with the statement.. any suggestions? Ta! Quote Link to comment Share on other sites More sharing options...
rhyspaterson Posted July 9, 2007 Author Share Posted July 9, 2007 edit: table name was wrong >_> Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted July 9, 2007 Share Posted July 9, 2007 User is a reserved word in PostgreSQL. Having only ever used mysql, i cant guarantee it, but i would guess the quickfix is to use backticks (`) around your field names: $result = pg_exec($dbconn, "UPDATE `user` SET `name` = '$username', `password` = '$userPassword' WHERE id = '$userID'"); The proper solution is to not use reserved words as table or column names. 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.