NEX2NUN,
A Quick Google search turned up this website: http://www.modwest.com/help/kb6-253.html
Where a user contributed the following code:
<?
# first get a mysql connection as per the FAQ
$fcontents = file ('./spreadsheet.xls');
# expects the csv file to be in the same dir as this script
for($i=0; $i<sizeof($fcontents); $i++) {
$line = trim($fcontents[$i]);
$arr = explode("\t", $line);
#if your data is comma separated
# instead of tab separated,
# change the '\t' above to ','
$sql = "insert into TABLENAME values ('".
implode("','", $arr) ."')";
mysql_query($sql);
echo $sql ."<br>\n";
if(mysql_error()) {
echo mysql_error() ."<br>\n";
}
}
?>
Check their notes where they mention to change the '\t' to ',' for COMMA delimited (CSV).
Also, if you look at the php manual at fwrite()
You will see many great examples of edit text files.
One thought though: If you are editing PHP files directly, if your application crashes out or there is some error somehow, it can break the application running the file.
I would recommend using as much as you can from a Database, or CSV / XML file.
If your intention is to create a CSV file and import it - these links should certainly get you started.