[thelist] PHP Quickie

Jay Blanchard jay.blanchard at niicommunications.com
Wed Aug 28 06:38:01 CDT 2002


[snip]
can anyone spot why this snippet isn't pully records from a bunch of csv
files

$filearray = file ("admin/databases/groups.csv");
while (list ($no, $line) = each ($filearray)) {
	$s = split (";", $line);
	if ($s[0] == "MAIN GROUP") echo " | <a href=\"products.php?m=". substr (md5
($s[1]), 0, 10) ."\">$s[1]</a>";
}
unset ($filearray, $no, $line, $s);
[/snip]

Andrew,

The file is a .csv which is comma seperated, right? If so you are splitting
by a semi-colon;
	$s = split (";", $line);
should be
	$s = split (",", $line);
Now the file could be named with a csv extension and use any seperator,
including the semi-colon, as it is just a text file. Other than that I would
have to see a couple of lines of the groups.csv so that I could test.

HTH!

Jay

*****************************************************
* Texas PHP Developers Conf  Spring 2003            *
* T Bar M Resort & Conference Center                *
* New Braunfels, Texas                              *
* Contact jay.blanchard at niicommunications.com       *
*                                                   *
* Want to present a paper or workshop? Contact now! *
*****************************************************





More information about the thelist mailing list