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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.