• Resolved GuidoCimurro

    (@guidocimurro)


    Hi and thank-you very much for your plugin.
    Relevanssi work very well, but I find this error in my error_log_php.log for every searching:

    WordPress errore sul database 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 2 per la query SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE term_id= fatta da require, wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, apply_filters_ref_array, call_user_func_array, relevanssi_query, relevanssi_search

    I’m running MySql 5.1.48-log.

    Thank you.

    https://www.ads-software.com/extend/plugins/relevanssi/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Sounds odd. Every search? Does anything change in the error message, is it always the same? You’re running WP 3.0.1, apparently, but which version of Relevanssi? The latest?

    Thread Starter GuidoCimurro

    (@guidocimurro)

    Same error for every search.

    WordPress 3.0.1
    Relevanssi 2.0.3

    Thank-you for your helping!

    Plugin Author Mikko Saari

    (@msaari)

    There are actually three MySQL queries like that in the source code, so figuring this out is pretty hard without knowing which one it is… But I’d still say it’s something in your setup, as I haven’t seen similar errors on my sites.

    Thread Starter GuidoCimurro

    (@guidocimurro)

    I solved excluding the third query

    if (isset($taxonomy)) {
    $term_id = $wpdb->get_var(“SELECT term_id FROM $wpdb->terms WHERE name LIKE ‘$taxonomy_term'”);
    $term_tax_id = $wpdb->get_var(“SELECT term_taxonomy_id FROM $wpdb->term_taxonomy
    WHERE term_id=$term_id”);
    $taxonomy = $term_tax_id;
    }

    with

    //if (isset($taxonomy)) {
    if (1==2) {
    $term_id = $wpdb->get_var(“SELECT term_id FROM $wpdb->terms WHERE name LIKE ‘$taxonomy_term'”);
    $term_tax_id = $wpdb->get_var(“SELECT term_taxonomy_id FROM $wpdb->term_taxonomy
    WHERE term_id=$term_id”);
    $taxonomy = $term_tax_id;
    }

    Is that query to scan custom taxonomies?

    Thanks and sorry for my bad english.

    Plugin Author Mikko Saari

    (@msaari)

    Yes, this one is custom taxonomies. I’m not 100% sure, but I think the error message is protesting the fact the $term_id is empty. So, I suppose this should be fixed with a simple check to make sure $term_id actually contains something. Problem solved?

    Replace the code with this bit and tell me what happens:

    if (isset($taxonomy)) {
    		$term_tax_id = null;
    		$term_id = $wpdb->get_var("SELECT term_id FROM $wpdb->terms WHERE name LIKE '$taxonomy_term'");
    		if ($term_id) {
    			$term_tax_id = $wpdb->get_var("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy
    					WHERE term_id=$term_id");
    		}
    		$taxonomy = $term_tax_id;
    	}
    Thread Starter GuidoCimurro

    (@guidocimurro)

    That’s great! Thank-you so much!

    Plugin Author Mikko Saari

    (@msaari)

    I just released 2.1, which includes the fix.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Relevanssi] Error in error_log_php’ is closed to new replies.