<?php
function refresh_friends($id) {
$result = mysql_query("SELECT * FROM `friends` WHERE `user` = '".$id."'");
while ($friend = mysql_fetch_array($result)) {
$fri = mysql_fetch_assoc(mysql_query("SELECT `rating`,`online` FROM `users` WHERE `id` = '".$friend["friend"]."'"));
mysql_query("UPDATE `friends` SET `rating` = '".$fri['rating']."',`online` = '".$fri['online']."' WHERE `user` = '".$id."' and `friend` = '".$friend['friend']."'");
}
}
?>