Jump to content

Syntax Error


Recommended Posts

Hey guys,


I keep getting this 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 'WHERE subject='Application: Jaxxit'' at line 1


Its from this query:


mysql_query("INSERT INTO mybb_threads (appid) VALUES ('$appid') WHERE subject='Application: $char_name'") or die(mysql_error());


Does anyone know what is wrong with it?



Link to comment
Share on other sites

I need to insert a value into a pre-existing row in a table. Here's the basic break-down:


1) User fills out a form.

2) A thread is created in [table A] (MyBB) with data gathered from the form

3) Insert portions of the data gathered from the form into [table B] as well


I need a means of linking both the item in [table A] and the item in [table B] together for future queries. I opted for creating a new field in [table A] and inserting the ID number of the item inserted into [table B]. The problem is, I need to insert the ID number from the item in [table B] into the correct item in [table A]. It is proving to be difficult since there really isn't any pre-existing unique value which I could use to link the item in [table A] to the one in [table B].


I think I may just end up generating a random salt, throwing it in each upon creation and linking them that way. Unless of course you see a solution to the problem I mentioned earlier.


Oh my... its 12:00. I have to get up in 5 hours for work. I'll check back here tomorrow.

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.

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.