<?php
include_once "../connect_to_mysql.php";
$query = "Select Industry, AVG(Current_Value) FROM stock_index";
$result = mysql_query($query) or die(mysql_error());
//Print out results
while($row = mysql_fetch_array($result)){
$myFile = "_AVG.txt";
$date = date("M j, Y");
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData2 = "\n \n <period name=$date> \n <v>".$row['AVG(Current_Value)']."</v>";
fwrite($fh, $stringData2);
echo"$stringData2";
fclose($fh);
}
?>
|