We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Error message when installing this extension

Development and Programming

craiguffman's avatar
craiguffman
100 posts
16 years ago
craiguffman's avatar craiguffman

This question may be related to a resolved thread.

I am trying to install Robin Sewell’s extension in the related post. I’d appreciate help with the following error message:

Parse error: syntax error, unexpected ‘;’, expecting T_FUNCTION in /www/eh9265/public_html/ccsys/extensions/ext.forum_fill.php on line 115

Line 115 is the last line of the code (basically substituting my weblog id and field id and forum id.

Here is the only edit I made in the code:

<pre><code>if ($IN->GBL(‘weblog_id’, ‘POST’) == 4) { $_POST[“forum_title”] = $IN->GBL(‘title’, ‘POST’); $_POST[“forum_id”] = 8; $_POST[“forum_body”] = $IN->GBL(‘field_id_7’, ‘POST’);
} elseif ($IN->GBL(‘weblog_id’, ‘POST’) == 6) { $_POST[“forum_title”] = $IN->GBL(‘title’, ‘POST’); $_POST[“forum_id”] = 8; $_POST[“forum_body”] = $IN->GBL(‘field_id_16’, ‘POST’);

        return;
}[/code]
       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

Morning craiguffman. Think I just sent you an email on this one- but for general consumption- looks like you need to close that last elseif out. In other words- try adding a closing bracket above the return.

That do it?

(Also shifting to the extensions folder.)

       
craiguffman's avatar
craiguffman
100 posts
16 years ago
craiguffman's avatar craiguffman

Thanks, Robin. The closing bracket did the trick. FYI, I copied that off the original thread, so one might consider updating the zip to reflect the if/ then logic that was you later posted on the thread… Although most others would catch the closing bracket, I am sure.

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

😉 Glad that worked for you. Since the thread was closed, I just added an ETA to the part with the download and linked to here for folks who do run into a problem with it. (I’ll still overlook mismatched brackets- it’s easy to do!)

       
craiguffman's avatar
craiguffman
100 posts
16 years ago
craiguffman's avatar craiguffman

Thanks for the help so far. I am getting another error message. Here’s the context. I submit a test weblog entry for either of the two weblogs I hardcoded in the PHP of the forum_fill extension. The extension is coded to create a forum topic_id and also write a backlink into the forum body. It does both of these successfully. Unfortunately, it now generates a SQL error each time a publish an entry:

MySQL ERROR: Error Number: 1064 Description: 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 ‘http://mysite.com/article_namei’ at line 1

THIS IS THE URL CORRECTLY GENERATED BY THE PERMALINK VARIABLE IN THE BACKLINK.

So it is doing what I want it to do perfectly but for some reason generates the error message after every post (rather than going to the preview), though nothing seems to actually be failing. It only generates the error condition if the entry is for one of the two weblogs for which it is supposed to create a forum_topic_id automatically.

So it seems to encounter the error AFTER it creates the forum topic and backlink (since it writes both successfully).

Any ideas on how to avoid this MySQL error? It seems to be bogus to me since everything I told the system to do is actually happening.

I have pasted the relevant section of the extension below and attached it in its entirety.

function forum_data()
    {
    global $IN;
if ($IN->GBL('weblog_id', 'POST') == 4)
        {
            $_POST["forum_title"] = $IN->GBL('title', 'POST');
            $_POST["forum_id"] = 8;
            $_POST["forum_body"] = $IN->GBL('field_id_6', 'POST') . "\nView the <a href="http://{permalink}" title='View the original post in the blog'>original post</a>";
            /* $_POST["forum_body"] = $IN->GBL('field_id_6', 'POST'); */        
        }
        elseif ($IN->GBL('weblog_id', 'POST') == 6)
        {
            $_POST["forum_title"] = $IN->GBL('title', 'POST');
            $_POST["forum_id"] = 4;
            /* $_POST["forum_body"] = $IN->GBL('field_id_15', 'POST'); */
            $_POST["forum_body"] = $IN->GBL('field_id_15', 'POST') . "\nView the <a href="http://{permalink}" title='View the original post in the blog'>original post</a>"; 
            
            }

            return;
    }
       
craiguffman's avatar
craiguffman
100 posts
16 years ago
craiguffman's avatar craiguffman

I am still encountering the SQL error above. Any ideas on how to fix it?

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

Can you give me a bit more of the sql error? It will show the actual query- I’d like to take a look at where that breaks.

       
craiguffman's avatar
craiguffman
100 posts
16 years ago
craiguffman's avatar craiguffman

Here’s the error message I am getting….

MySQL ERROR: Error Number: 1064 Description: 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 ‘http://mysite/index.php/mytemplategroup/test_for_robin_sewell/’ title=” at line 1 Query: UPDATE exp_forum_topics SET title = ‘Test for Robin Sewell’, body = ‘This is a test. Worship the Lord in the beauty of holiness. Come let us adore him. Alleluia. Worship the Lord in the beauty of holiness. View the original post ’ WHERE topic_id = ‘23’
       
craiguffman's avatar
craiguffman
100 posts
16 years ago
craiguffman's avatar craiguffman

Do I need to provide more information on this error condition in order to move forward in resolving it?

As I said, the SQL error is happening each and every time an entry is made to the most important weblog/channel on my site and it terminates all processing at that point. It is a major problem for me. I’d greatly appreciate some technical assistance on this.

Thanks! Craig

       
Robin Sowell's avatar
Robin Sowell
13,160 posts
16 years ago
Robin Sowell's avatar Robin Sowell

I suspect something is getting stripped out of the post- since the link triggering the error doesn’t actually show in the posted sql.

Try removing the single quotes- might be running into an issue w/how permalink is parsed. Though I’m not seeing why off hand.

       
craiguffman's avatar
craiguffman
100 posts
16 years ago
craiguffman's avatar craiguffman

Robin, Can you be more specific about the change you are suggesting? Which single quotes are you speaking about? All of them? Or just some of them? I tried removing them around the permalink and got another SQL error:

Changing to this,

$_POST["forum_body"] = $IN->GBL('field_id_6', 'POST') . "\nView the <a href="http://{permalink}" title="View the original post in the blog">original post</a>";

gave me this:

Parse error: syntax error, unexpected ‘{’ in /mypath/extensions/ext.forum_fill.php on line 37
       
craiguffman's avatar
craiguffman
100 posts
16 years ago
craiguffman's avatar craiguffman

Just to be clear about the error message because it may impact your thinking.

Query: UPDATE exp_forum_topics SET title = ‘Test for Robin Sewell’, body = ‘This is a test. View the original post ’ WHERE topic_id = ‘23’

I have bolded in the quote the words “original post.” In the error message, they display as a proper hyperlink to the correct weblog post.

So the Set body = ‘text’ clause is not closed as it is returned in the error message. Not sure if that is meaningful but i want to point it out just in case it is.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.