Hello,
I made a page that calls 12 random records from the MySql database and shows them as a list. However, it takes a long time because I have a lot of records. I would like to output to a text file and run a cron tab to activate this every 24 hours. All of this in no problem execpt - - how do I get the list to a txt file. The following works for generating a list but not for updating the txt file:
<?
include ("config.inc.php");
$sql = "select distinct * from viptransactions order by Rand() limit 12";
$namo = mysql_query($sql);
$r = mysql_fetch_array($namo);
do{
printf("<center><font face=\"Arial\" size=\"2\"><b>%s %s</b></font></center>\n", $r["customer"], $r["custid"]);
} while ($r = mysql_fetch_array($namo));
$filename ="win.txt";
$handle= fopen($filename,'w');
$string = "$namo";
fputs($handle, $string);
fclose($handle);
?>
Thank You.