karimali831 Posted July 5, 2010 Share Posted July 5, 2010 Can't figure it out.. safe_query("UPDATE ".PREFIX."cup_warnings SET points='".$_POST['points']."', adminID='".$_POST['adminID']."', title='".$_POST['title']."', desc='".$_POST['desc']."', matchlink='".$_POST['matchlink']."', time='".$_POST['time']."', deltime='".$_POST['deltime']."', 1on1='0' WHERE clanID='".$_POST['clanID']."' && warnID='".$_POST['warnID']."'"); Output: # Query failed: errorno=1064 # 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 'desc='', matchlink='http://', time='1278321080', deltime='1278374400', 1on1='0' ' at line 1 # query=UPDATE webs_cup_warnings SET points='10', adminID='1', title='', desc='', matchlink='http://', time='1278321080', deltime='1278374400', 1on1='0' WHERE clanID='11' && warnID='42' I am certain the columns match the columns on the table. See attatchment Hope someone can help. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/206757-failed-query/ Share on other sites More sharing options...
Mchl Posted July 5, 2010 Share Posted July 5, 2010 http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html Quote Link to comment https://forums.phpfreaks.com/topic/206757-failed-query/#findComment-1081264 Share on other sites More sharing options...
karimali831 Posted July 5, 2010 Author Share Posted July 5, 2010 I went over it 100 times, the query fails just because of $_POST['desc'] and I am soo lost to why it's doing this. It does not make any sense. <input type="text" name="desc" value="'.$dd['desc'].'" size="8"></td> ...title='".$_POST['title']."', desc='".$_POST['desc']."', matchlink='".$_POST['matchlink']."',... excluding the query in bold will execute the query fine and my table has "desc" as a column so why is it failing? Quote Link to comment https://forums.phpfreaks.com/topic/206757-failed-query/#findComment-1081274 Share on other sites More sharing options...
Mchl Posted July 5, 2010 Share Posted July 5, 2010 It's explained in the link I provided. DESC is a MySQL's reserved word, and if you decided to call you column like that, you need to put backticks around it. safe_query("UPDATE ".PREFIX."cup_warnings SET points='".$_POST['points']."', adminID='".$_POST['adminID']."', title='".$_POST['title']."', `desc`='".$_POST['desc']."', matchlink='".$_POST['matchlink']."', time='".$_POST['time']."', deltime='".$_POST['deltime']."', 1on1='0' WHERE clanID='".$_POST['clanID']."' && warnID='".$_POST['warnID']."'"); Quote Link to comment https://forums.phpfreaks.com/topic/206757-failed-query/#findComment-1081278 Share on other sites More sharing options...
karimali831 Posted July 5, 2010 Author Share Posted July 5, 2010 THANKS SOO MUCH! Quote Link to comment https://forums.phpfreaks.com/topic/206757-failed-query/#findComment-1081295 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.