MrBillybob Posted August 2, 2007 Share Posted August 2, 2007 query: $sql = 'SELECT * FROM `eve_wallet` WHERE `refType` = \'' . $in_refType . '\''; error: 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 What causes this? Quote Link to comment https://forums.phpfreaks.com/topic/63014-solved-sql-query-error/ Share on other sites More sharing options...
ToonMariner Posted August 2, 2007 Share Posted August 2, 2007 echo out the string and copy and paste it direct into phpmyadmin (or similar) see what error that throws... Quote Link to comment https://forums.phpfreaks.com/topic/63014-solved-sql-query-error/#findComment-313806 Share on other sites More sharing options...
mtoldfield Posted August 2, 2007 Share Posted August 2, 2007 So the actual query is... SELECT * FROM `eve_wallet` WHERE `refType` = 'variableoutput' Seems fine to me. Personally though, I have had problems when using the ` `. I don't use those with my queries and they seem to run fine. Have you tried that? Otherwise, have you just tried the following: $sql = 'SELECT * FROM `eve_wallet` WHERE `refType` = \'$in_refType\''; Usually works for me... Quote Link to comment https://forums.phpfreaks.com/topic/63014-solved-sql-query-error/#findComment-313807 Share on other sites More sharing options...
MrBillybob Posted August 2, 2007 Author Share Posted August 2, 2007 i have i c&p'ed this SELECT * FROM `eve_wallet` WHERE `refType` = 'Bounty Prize' and it worked Quote Link to comment https://forums.phpfreaks.com/topic/63014-solved-sql-query-error/#findComment-313808 Share on other sites More sharing options...
ToonMariner Posted August 2, 2007 Share Posted August 2, 2007 swap $sql = 'SELECT * FROM `eve_wallet` WHERE `refType` = \'' . $in_refType . '\''; for $sql = "SELECT * FROM `eve_wallet` WHERE `refType` = '" . $in_refType . "'"; I prefer double quotes AND concatenation on query strings - IMO its easier to read the code then! Quote Link to comment https://forums.phpfreaks.com/topic/63014-solved-sql-query-error/#findComment-313813 Share on other sites More sharing options...
MrBillybob Posted August 2, 2007 Author Share Posted August 2, 2007 still doesnt work i have tried all of these... P.S. not trying to be rude Quote Link to comment https://forums.phpfreaks.com/topic/63014-solved-sql-query-error/#findComment-313814 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.