[thelist] Apache PHP CSV

Hassan Schroeder hassan at webtuitive.com
Wed Aug 21 09:13:01 CDT 2002


Andrew Maynes wrote:

 > if ($m) {
 >
 > $filearray = file ("admin/databases/groups.csv");

Uh, well, I haven't used PHP a lot, but -- this line has *zero*
error handling. It *assumes* that the file access succeeds.

I'd recommend that before opening a possibly non-existent file, you
check with file_exists() or (maybe better for this exercise) stat()
and return an appropriate error message on failure.

A browse through the PHP FileSystem Functions might be useful ...

FWIW!
--
H*
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

     -- creating dynamic Web sites and applications since 1994 --





More information about the thelist mailing list