--- votingapi.module	2011-02-23 02:44:13.000000000 +0300
+++ votingapi.module	2011-02-23 02:49:08.000000000 +0300
@@ -71,10 +71,10 @@
   if (variable_get('votingapi_calculation_schedule', 'immediate') == 'cron') {
     $time = REQUEST_TIME;
     $last_cron = variable_get('votingapi_last_cron', 0);
-    $result = db_query('SELECT DISTINCT entity_type, entity_id FROM {votingapi_vote} WHERE timestamp > %d', $last_cron);
+    $result = db_query('SELECT DISTINCT entity_type, entity_id FROM {votingapi_vote} WHERE timestamp > :timestamp', array(':timestamp' => $last_cron));
 
-    while ($content = db_fetch_object($result)) {
-      votingapi_recalculate_results($content->entity_type, $content->entity_id, TRUE);
+    foreach ($result as $content) {
+        votingapi_recalculate_results($content->entity_type, $content->entity_id, TRUE);
     }
 
     variable_set('votingapi_last_cron', $time);
