emmy Posted October 31, 2012 Share Posted October 31, 2012 I am having the same issue here but on postgreSQL database. I keep getting SYNTAX ERROR error at the update line, please can someone help $query = "Select * from fieldtally where 'pipeno' = $pipeno; BEGIN; INSERT INTO fieldtally(pipeno,wthick,djointno,heatno1)VALUES('$pipeno','$wthick','$djointno','$heatno1'); WHERE EXIST, UPDATE fieldtally set 'pipeno'=$pipeno,'wthick'=$wthick,'djointno'=$djointno,'heatno1'=$heatno1); END"; Quote Link to comment https://forums.phpfreaks.com/topic/270133-where-exists-help/ Share on other sites More sharing options...
Christian F. Posted January 24, 2013 Share Posted January 24, 2013 Try to remove the single quotes around the field names. Quote Link to comment https://forums.phpfreaks.com/topic/270133-where-exists-help/#findComment-1407916 Share on other sites More sharing options...
vinny42 Posted August 12, 2013 Share Posted August 12, 2013 The quotes around the fieldnames are wrong, but not a syntax error. The error is in the WHERE EXISTS that just appears in the middle of nowhere: INSERT INTO fieldtally(pipeno,wthick,djointno,heatno1)VALUES('$pipeno','$wthick','$djointno','$heatno1'); WHERE EXIST, UPDATE fieldtally set 'pipeno'=$pipeno,'wthick'=$wthick,'djointno'=$djointno,'heatno1'=$heatno1); I think you've been writing a query using English grammer rather than SQL grammer. What are you trying to do with the query? Quote Link to comment https://forums.phpfreaks.com/topic/270133-where-exists-help/#findComment-1444565 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.