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]
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;
}
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’
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, 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
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.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.