• VesaT

    (@vesat)


    Hi,

    I’ve been using WPi18n now for a fairly long time. Everything has worked pretty much ok, but now he web host is giving errors like the one below, and the hosting operator support says this is due to a new version of MySQL (5.1.68-cll – MySQL Community Server (GPL)) – it was uprgraded in December last year and since then the syntax errors have been present every now and then:

    [06-Mar-2013 06:18:44 UTC] WordPress-database error – 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 ” at line 1 for query

    SELECT post_type FROM wp_posts WHERE ID= Tekij?: require(‘wp-blog-header.php’), require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), do_action(‘plugins_loaded’), call_user_func_array, SitePress->init, get_page_link, apply_filters(‘page_link’), call_user_func_array, SitePress->permalink_filter

    I had a look at what maybe causes this and found a similar type of SELECT clause in sitepress.class file within function permalink_filter. However, I do not have capabilities to correct this one. Hope the author or somebody else would find a fix. Code below copied from sitepress.class

    function permalink_filter($p, $pid){
            global $wpdb;
            if(is_object($pid)){
                $pid = $pid->ID;
            }
            if($pid == (int)get_option('page_on_front')){
                /* preWP3 compatibility  - start */
                if(ICL_PRE_WP3){
                    $p = $this->convert_url($p, $this->get_current_language());
                }
                /* preWP3 compatibility  - end */
                return $p;
            }
    <strong>        $post_type = $wpdb->get_var("SELECT post_type FROM {$wpdb->posts} WHERE ID={$pid}");</strong><em>
            $element_lang_details = $this->get_element_language_details($pid,'post_'.$post_type);
            if($element_lang_details->language_code && $this->get_default_language() != $element_lang_details->language_code){
                $p = $this->convert_url($p, $element_lang_details->language_code);
            }elseif(isset($_POST['action']) && $_POST['action']=='sample-permalink'){ // check whether this is an autosaved draft
                $exp = explode('?', $_SERVER["HTTP_REFERER"]);
                if(isset($exp[1])) parse_str($exp[1], $args);
                if(isset($args['lang']) && $this->get_default_language() != $args['lang']){
                    $p = $this->convert_url($p, $args['lang']);
                }
            }
            if(is_feed()){
                $p = str_replace("&lang=", "&lang=", $p);
            }
            return $p;
        }

    https://www.ads-software.com/extend/plugins/wp-i18n/

  • The topic ‘New MySQL giving syntax erros’ is closed to new replies.