i write following code to copy values from one table to another table but $wpdb->get_results not returning anything.
function rating_convert() {
global $wpdb;
$likes = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'up_down_comment_vote_totals', ARRAY_N);
foreach ($likes as $like) {
$wpdb->query('UPDATE ' . $wpdb->prefix . 'comment_rating SET ck_rating_up = ' . $like['vote_count_up'] . ' WHERE ck_comment_id = ' . $like['comment_id']);
$wpdb->query('UPDATE ' . $wpdb->prefix . 'comment_rating SET ck_rating_down = ' . $like['vote_count_down'] . ' WHERE ck_comment_id = ' . $like['comment_id']);
}
}
i have tested every line with echo function.foreach line not running and i think $wpdb->get_results is wrong.
please help me.
Sorry for my bad english.
i solve this.
my table have 147,308 rows.
problem is table rows number.
i add LIMIT code for only get 1000 rows and remove every row after copy to another table.thanks.