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