MyBB Community Forums

Full Version: [SQL Error] Can't post after installing My Alerts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I just installed My Alerts, but I can't post on any thread. I receive a SQL Error message everytime I try to post something:

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 'LIMIT 1' at line 1
Query:
    SELECT uid,subject,fid FROM mybb_threads WHERE tid = LIMIT 1 

Plus, the alerts button is in a bad spot:

[Image: skwn.png]

Edit: It messed up my other buttons as well: edit and multiquote.

How can I fix everything? Help! >_<
You have to verify if have a trouble with jQuery instead.

Then you have to review why you don´t get tid value.

What version of MyBB do you use ?

Do you have an url to your site ?

Maybe in this point can start xD.
(2014-03-18, 07:12 AM)Dark Neo Wrote: [ -> ]You have to verify if have a trouble with jQuery instead.

Then you have to review why you don´t get tid value.

What version of MyBB do you use ?

Do you have an url to your site ?

Maybe in this point can start xD.

I'm using 1.6.9.

My URL is www.asianchords.com.br
Hey Ann!

Your SQL has an error, not your jQuery, don't worry. If you look at the query it states the tid = LIMIT 1, which is not what you want. You want tid = some # LIMIT 1, you didn't give a condition for which tid you're finding.
(2014-03-21, 04:07 AM)Miah Wrote: [ -> ]Hey Ann!

Your SQL has an error, not your jQuery, don't worry. If you look at the query it states the tid = LIMIT 1, which is not what you want. You want tid = some # LIMIT 1, you didn't give a condition for which tid you're finding.

Hello, Miah! Smile
How can I fix it then?
I never seen this error before, make sure in wich line do you have that SQL and put an int_val to the conditional, so, you have 0 return if some value don't be find xD.

Or just add a conditional to do nothing if results are equal to nothing or 0, then if you have a value with more than one on that id make your query and your trouble have to disapear and you can fix this, but you have to know why you got that id, maybe you have to change on some parts your var for that value and i recomend you to use a debugger to do that.

Cheers.
Do you have any other plugins affecting posting or anything? I've never seen this error occur before. I can see where it is happening, but it shouldn't.

function myalerts_alert_post_threadauthor(&$post)
{
    global $mybb, $Alerts, $db, $cache;

    if (!$post->data['savedraft']) {
        $forumPerms = $cache->read('forumpermissions');

        if ($post->post_insert_data['tid'] == 0) {
            $query = $db->simple_select('threads', 'uid,subject,fid', 'tid = '.$post->data['tid'], array('limit' => '1'));
            $thread = $db->fetch_array($query);
        } else {
            $query = $db->simple_select('threads', 'uid,subject,fid', 'tid = '.$post->post_insert_data['tid'], array('limit' => '1'));
            $thread = $db->fetch_array($query);
        }
(2014-03-21, 07:31 AM)Euan T Wrote: [ -> ]Do you have any other plugins affecting posting or anything? I've never seen this error occur before. I can see where it is happening, but it shouldn't.

function myalerts_alert_post_threadauthor(&$post)
{
    global $mybb, $Alerts, $db, $cache;

    if (!$post->data['savedraft']) {
        $forumPerms = $cache->read('forumpermissions');

        if ($post->post_insert_data['tid'] == 0) {
            $query = $db->simple_select('threads', 'uid,subject,fid', 'tid = '.$post->data['tid'], array('limit' => '1'));
            $thread = $db->fetch_array($query);
        } else {
            $query = $db->simple_select('threads', 'uid,subject,fid', 'tid = '.$post->post_insert_data['tid'], array('limit' => '1'));
            $thread = $db->fetch_array($query);
        }

What do you mean with plugins affecting posts?

Edit: I saw someone having the same problem. I think he repported it in the My Alerts thread. I'm not sure, though.
Edit2: It was a user called Diddums. Third post:

http://community.mybb.com/thread-127444-page-70.html

Please, can you help me Euan? My users are asking for this system. I really need it, because the competitors forums have it.