• Resolved kzq

    (@kzq)


    I have facing this error in PHP Error Log What is this?

    [02-Jan-2010 19:36:18] 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 rating_username, rating_rating, rating_ip FROM wp_ratings WHERE rating_postid = made by require, require_once, include, the_post, WP_Query->the_post, do_action_ref_array, call_user_func_array, get_comment_authors_ratings

Viewing 4 replies - 1 through 4 (of 4 total)
  • what version of WordPress and MySql are you using? also are you installing or creating a Plug-in.

    Because it look like that you are trying to run a custom MySql query and you have a bad syntax.

    Thread Starter kzq

    (@kzq)

    I am using MySQL server version 5.1.36 and I have installed wp-postratings plugin. I have found something here

    yes it looks like that there is a problem with the plugin “wp-postratings” try to contact the developer and see if they can fix it.

    for the moment I recommend removing the plugin or see if you can find a similar plugin that you can use

    or you have to open the plugin file and replace the code :

    add_action('loop_start', 'get_comment_authors_ratings');
    function get_comment_authors_ratings() {
    	global $wpdb, $post, $comment_authors_ratings;
    	$comment_authors_ratings = array();
        if($post->ID) {
    		$comment_authors_ratings_results = $wpdb->get_results("SELECT rating_username, rating_rating, rating_ip FROM $wpdb->ratings WHERE rating_postid = ".$post->ID);
    	}
    	if($comment_authors_ratings_results) {
    		foreach($comment_authors_ratings_results as $comment_authors_ratings_result) {
    			$comment_author = stripslashes($comment_authors_ratings_result->rating_username);
    			$comment_authors_ratings[$comment_author] = $comment_authors_ratings_result->rating_rating;
    			$comment_authors_ratings[$comment_authors_ratings_result->rating_ip] = $comment_authors_ratings_result->rating_rating;
    		}
    	}
    }

    with

    add_action('loop_start', 'get_comment_authors_ratings');
    function get_comment_authors_ratings() {
    	global $wpdb, $post, $comment_authors_ratings;
    	if(!is_feed() && !is_admin()) {
    		$comment_authors_ratings = array();
    		if($post->ID) {
    			$comment_authors_ratings_results = $wpdb->get_results("SELECT rating_username, rating_rating, rating_ip FROM $wpdb->ratings WHERE rating_postid = ".$post->ID);
    		}
    		if($comment_authors_ratings_results) {
    			foreach($comment_authors_ratings_results as $comment_authors_ratings_result) {
    				$comment_author = stripslashes($comment_authors_ratings_result->rating_username);
    				$comment_authors_ratings[$comment_author] = $comment_authors_ratings_result->rating_rating;
    				$comment_authors_ratings[$comment_authors_ratings_result->rating_ip] = $comment_authors_ratings_result->rating_rating;
    			}
    		}
    	}
    }
    Thread Starter kzq

    (@kzq)

    thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WordPress Database Error’ is closed to new replies.