Jump to content

Failed query


karimali831

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/206757-failed-query/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/206757-failed-query/#findComment-1081274
Share on other sites

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']."'");

Link to comment
https://forums.phpfreaks.com/topic/206757-failed-query/#findComment-1081278
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.