<?php
$qcomm = mysql_query("SELECT * FROM `comm` ORDER BY `id` DESC");
while ($comm = mysql_fetch_assoc($qcomm))
{
	$rating = $comm['rating']+$comm['rating_tmp'];
	mysql_query("UPDATE `comm` SET `rating` = '$rating' WHERE `id` = '$comm[id]'");
	mysql_query("UPDATE `comm` SET `rating_tmp` = '0' WHERE `id` = '$comm[id]'");
}
?>