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

SQL error on Publish in Control Panel

Development and Programming

Paul Bell's avatar
Paul Bell
103 posts
16 years ago
Paul Bell's avatar Paul Bell

Hello,

Had a site working well on my local server, and now moved to production server. Whenever I publish an entry in the control panel I get the following error:

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 '-body,field_ft_14 AS fmt_news-body,field_id_15 AS id_15,field_id_15 AS news-imag' at line 1

Query: SELECT field_id_14 AS id_14,field_id_14 AS news-body,field_ft_14 AS fmt_news-body,field_id_15 AS id_15,field_id_15 AS news-image,field_ft_15 AS fmt_news-image FROM exp_weblog_data WHERE entry_id='35'

Not sure why this would be happening. If you could point me in the right direction.

Server setup is fairly standard (Linux, PHP 5.2.0 and MySQL 5.0.18), and everything else appears to be working fine.

       
Paul Bell's avatar
Paul Bell
103 posts
16 years ago
Paul Bell's avatar Paul Bell

Also, should have mentioned that I’m on build 20081114, and I’m using a few extensions, but having disabled them, still getting the error. The actual entry does submit though…

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Paul, what field type is news-body?

       
Paul Bell's avatar
Paul Bell
103 posts
16 years ago
Paul Bell's avatar Paul Bell

It’s a textarea

       
Pascal Kriete's avatar
Pascal Kriete
2,589 posts
16 years ago
Pascal Kriete's avatar Pascal Kriete

What are the names of extensions you have installed? Particularly interesting would be any that hook into the publish screen.

Do you have any non-native formatting options set (through an extension, for example)?

       
Paul Bell's avatar
Paul Bell
103 posts
16 years ago
Paul Bell's avatar Paul Bell

Sorted it in the end. It was the Preparse extension from Solspace. I guess it’s because I’d enabled it without setting any preferences. I’ll post over at Solspace forums to let them know.

Having disabled that, I came up against another problem. I’d written an extension to redirect my users once they’d submitted a standalone entry form, using the ‘submit_new_entry_redirect’ hook. It was only supposed to do anything on the client side, when the user submits a standalone entry form, but I hadn’t realised it would also affect the redirect in the Control Panel - I just wanted it to do whatever it normally does. Here’s what I had initially:

function redirect_to_preview($entry_id, $data, $cp_call)
{
        global $FNS;
        if(!$cp_call)
        {
            return $FNS->create_url('/listings/preview/'.$entry_id);
        }

}

But of course, if it is a CP call, then the user doesn’t get redirected at all.

I modified it to get this:

<pre><code>function redirect_to_preview($entry_id, $data, $cp_call) { global $FNS; if(!$cp_call) { return $FNS->create_url(‘/listings/preview/’.$entry_id); } else { return BASE.AMP.’C=edit’.AMP.’M=view_entry’.AMP.’weblog_id=’.$data[’weblog_id’].AMP.’entry_id=’.$entry_id.AMP.’U=’.$type; } }</code></pre> (where the second part is a slightly modified version of line 4711 of cp.publish.php, but there’s no way of getting to the $type variable, so I had to go with this:

<pre><code>function redirect_to_preview($entry_id, $data, $cp_call) { global $FNS; if(!$cp_call) { return $FNS->create_url(‘/listings/preview/’.$entry_id); } else { return BASE.AMP.’C=edit’.AMP.’M=view_entry’.AMP.’weblog_id=’.$data[’weblog_id’].AMP.’entry_id=’.$entry_id; } }</code></pre> ie without putting the type in the URL. This means that the user in the CP doesn’t get the appropriate message about the entry either being updated or submitted, which is a shame. Have you got any ideas of a way round this?

Would it be possible for either $type to be passed to the extension, or for the code in cp.publish.php to be changed so that the value of $loc is only changed if the extension returns something, otherwise it’s left alone? Just a minor tweak, but then my first version would have worked all along…

Any thoughts or suggestions appreciated.

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
16 years ago
Ingmar Greil's avatar Ingmar Greil

Paul, this has become a rather extension-centric thread, and a bit away from regular Tech Support. Let me move it to the proper subforum for you.

       
Paul Bell's avatar
Paul Bell
103 posts
16 years ago
Paul Bell's avatar Paul Bell

Thanks, Ingmar. The questions in my last post are more to do with the coding of cp.publish.php rather than the writing of my particular extension, but I agree it’s got a bit further away from it’s original question…

       

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.