What I want to do is something like this below code generates top 4 rated users on my site, I would like to basicly run a script like this that will write this data to a file and then I can update it hourly with a cron job and include the generated file into a page, how would I do such a task?
<table width="100%">
<?
// make top 4 list
$res = mysql_query("select * from friend_vote order by total_value DESC limit 4");
$riders = mysql_num_rows($res);
$i=0;
while ($top4 = mysql_fetch_assoc($res))
{
if ($i/1 == ceil($i/1)) $list .= "<tr>";
$i++;
$refnumber = $top4['total_value'];
?>
<tr bgcolor="#FFF7D2">
<td align="center">
<?=show_user_photo($top4['id'],$photo_type='small',$user_name='yes');?><BR>
<?=$refnumber?>
</td>
</tr>
<? }
?></table>