while we're on the topic, what's the best way to append an CSV line onto the
end of a text file?

---mail.csv---
Justin,French,[EMAIL PROTECTED]\n
Fred,Flintstone,[EMAIL PROTECTED]\n
Barny,Rubble,[EMAIL PROTECTED]\n
---

I'd like to append a new line::

$newline = "Hank,Foo,[EMAIL PROTECTED]\n";

...onto the end of file.  I guess the process is, but I'm keen to hear
improvements :)


<?

$newline = "Hank,Foo,[EMAIL PROTECTED]\n";
$file = "data/mail.csv";

$fp = fopen($file,'a+');
flock ($fp,2);
fwrite($fp,$newline);
fclose($fp);

?>

I can't find fulock(), so I guess closing the $fp unlocks the lock.

Many thanks,

Justin French
--------------------
Creative Director
http://Indent.com.au
--------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to