I had a data in .csv format delimited with line break.
10
100
1000
How could these data(.csv) read and add to the rows returned from mysql query.
I had tried with the following
<?
// Reading Data
$row = 1;
$handle = fopen("test.csv", "r");
while (($data = fgetcsv($handle, 1000, "\n")) !== FALSE) {
$num = count($data);
// Reading data from CSV
for ($c=0; $c < $num; $c++) {
$data1[$c] = $data[$c] . "<br />\n";
//
while ($row = mysql_fetch_array($result)){
// Values fetched from mysql as numbers and is added
// to the data from csv
$totaldata = $row["1"] ;
// data added from csv file with line breaks
$amount = $totaldata+$data1[$c]);
echo $amount;
}
}
}
mysql_close($link);
fclose($handle);
?>
but with this code the only the last data(1000) is added.
In brief, from database 3 rows of data are fetched and with reference to this I want to add data from .csv files serially.