WP-PostRatings: list current user’s rated posts

Plugin questions are best asked on the plugin’s support forum.

But this code is wrong:

$result = $wpdb->get_results($sql) or die(mysql_error());

foreach( $results as $result ) {

 echo $result->name;
}

The foreach is backwards. Go for this (corrected $result to $results in the first line – added ‘s’):

$results = $wpdb->get_results($sql) or die(mysql_error());

foreach( $results as $result ) {

 echo $result->name;
}

Your first code block has the same problem. The return value of the query is an array. You need to loop through each item in the array. I do something like this for my old eyes;

$results = somearray();
foreach ($results as $item) {
   // do something with $item, an element in the array
}

(Typos….urk…sometimes hard to see after looking at the code all day long…)