Question : Saving data to multiple text file

I am trying to write a script that will connect to my database, grab their Full_Name and there Current_Value, save that data with timestamp.  Once this information have been written, I would like for the file to rename itself to the $Full_Name and save to one location.  

I have numerous entries, and I am trying to have one folder with all these files in it, here is the code I have to this point, can someone please help me?

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
<?php
	include_once "connect_to_mysql.php";
	$sql = mysql_query("SELECT Full_Name, Current_Value FROM stock_index");
	
	$Full_Name = $row["Full_Name"];
	$Current_Value = $row["Current_Value"];
	
// Set local PHP vars from the POST vars sent from flash
$todayDate = $_POST['todayDate'];

$new_path = realpath("./indices/$Full_Name/");
if(!file_exists($new_path)) {
  mkdir($new_path);
}
// This section edits your log file, if you don't need a text log file just delete these lines
$myFile = "indices/$Full_Name/Transaction_History.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = "\n \n Date: $todayDate  \n Name: $Full_Name \n Value: $Current_Value";
fwrite($fh, $stringData);
fclose($fh);
// End log file edit
?>

Answer : Saving data to multiple text file

sorry...this is
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
<?php
	include_once "connect_to_mysql.php";
	$sql = mysql_query("SELECT Full_Name, Current_Value FROM stock_index");
	
	$todayDate = $_POST['todayDate'];

	while ($fila = mysql_fetch_array($sql)) {
		$Full_Name = $fila['Full_Name'];
		$Current_Value = $fila['Current_Value'];

		$myFile = "indices/Transaction_History".$Full_Name.".txt";
		$fh = fopen($myFile, 'a') or die("can't open file");
		$stringData = "\n \n Date: $todayDate  \n Name: $Full_Name \n Value: $Current_Value";
		fwrite($fh, $stringData);
		fclose($fh);
	}

?>
Random Solutions  
 
programming4us programming4us