MyBB Community Forums

Full Version: SQL Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My Info:
http://www.fallberry.com/forum/
MyBB 1.6.2
SQL Engine MySQL 5.0.92

The error happens when I click on Subscribed Threads in the UserCP. This started out of the blue. It was not doing this last week. Also, I just signed up as a dummy member to check with a new account. I don't get the error message with this new account.

Error Message:
Quote:MyBB has experienced an internal SQL error and cannot continue.
SQL Error:
1064 - 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 ') AND uid='1'' at line 3
Query:
DELETE FROM mybb_threadsubscriptions WHERE tid IN (,) AND uid='1'

Other information
I have a second installation of MyBB on a different domain, different server, but same host. I use it as a dev site. I am getting an error there too. But only for one of the two accounts I have set up there. At the other domain, the error is:

Quote:MyBB has experienced an internal SQL error and cannot continue.
SQL Error:
1064 - 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 ',,,,,,,,,,,,) AND uid='2'' at line 3
Query:
DELETE FROM mybb_threadsubscriptions WHERE tid IN (,,,,,,,,,,,,,) AND uid='2'

Finally, it surprises me that the database would be trying to delete something when I'm only asking to see what the subscriptions are.
This is a copy and paste of a post I made on another forum about this error, with an explanation and fix:

Quote:It will run this query on the standard subscriptions page too; when it's looping through the threads, if you don't have permission to view a thread that you're subscribed to (i.e. the permissions were changed or something) it adds the tid to an array, and if the array isn't empty after it's looped through the threads, it turns the array into a string and puts it into the query to delete those subscriptions... but if it's doing this then the tid of the subscription would have to have been empty... in ./usercp.php, line 1240:

$del_subscriptions[] = $subscription['tid'];

change this to:

if($subscription['tid'])
{
	$del_subscriptions[] = $subscription['tid'];
}

Should be fine then.
When I saw how this would string two IF statements together I got a little worried. But it seems to be working okay.