Jump to content

Syntax Error


eRott

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?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/183933-syntax-error/
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
https://forums.phpfreaks.com/topic/183933-syntax-error/#findComment-970998
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.