jargen Posted February 14, 2010 Share Posted February 14, 2010 Whenever i try this code i get a syntax error. Any help? SELECT * FROM wp_newsoptions WHERE option='often' Link to comment https://forums.phpfreaks.com/topic/192069-sql-syntax-error/ Share on other sites More sharing options...
sader Posted February 14, 2010 Share Posted February 14, 2010 u can see error by mysql_query(blabla bla); echo mysql_error(); since query look fine u must double check table name, field name Link to comment https://forums.phpfreaks.com/topic/192069-sql-syntax-error/#findComment-1012307 Share on other sites More sharing options...
jargen Posted February 14, 2010 Author Share Posted February 14, 2010 All i get is a syntax error. #1064 - 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 'option="often" LIMIT 0, 30' at line 1 Link to comment https://forums.phpfreaks.com/topic/192069-sql-syntax-error/#findComment-1012310 Share on other sites More sharing options...
sader Posted February 14, 2010 Share Posted February 14, 2010 can u show your code please? Link to comment https://forums.phpfreaks.com/topic/192069-sql-syntax-error/#findComment-1012312 Share on other sites More sharing options...
jargen Posted February 14, 2010 Author Share Posted February 14, 2010 My code is: SELECT * FROM wp_newsoptions WHERE option='often' I am running it via the sql query in phpmyadmin. Link to comment https://forums.phpfreaks.com/topic/192069-sql-syntax-error/#findComment-1012315 Share on other sites More sharing options...
sader Posted February 14, 2010 Share Posted February 14, 2010 It's not code but query string. Ok would u get eneythink from this query SELECT * FROM wp_newsoptions Link to comment https://forums.phpfreaks.com/topic/192069-sql-syntax-error/#findComment-1012316 Share on other sites More sharing options...
jargen Posted February 14, 2010 Author Share Posted February 14, 2010 yes. Link to comment https://forums.phpfreaks.com/topic/192069-sql-syntax-error/#findComment-1012318 Share on other sites More sharing options...
PFMaBiSmAd Posted February 14, 2010 Share Posted February 14, 2010 option is a reserved mysql keyword. Either rename your column to something else or enclose option in back-ticks `option` in every query. Link to comment https://forums.phpfreaks.com/topic/192069-sql-syntax-error/#findComment-1012322 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.