kyle2k
09-03-2007, 08:05 AM
Hi all,
Im having a problem reading CSV data from a text file and storing it in a multidimensional array.
I have a text file like so.
Cathal|kyle@example.com|83.103.100.300|Wednesday 29th August 2007 @ 17:27-13|66023f4984
tony|tonto@example.com|83.107.82.300|Friday 31st August 2007 @ 12:46-49|1c3fd4594d
steve|imapisces@example.com|86.5.147.300|Friday 31st August 2007 @ 17:22-19|d61f895714
I want to take this data and create a multidimensional array from it.
I have been up all night trying various ways like the one shown below but I cant seem to achive what I need it to do.
$fp1 = fopen ("admin/data/pred.txt", 'rb');
while ( $array = fgetcsv ($fp1, 1024, "|")) {
$multi_array[$array[0]] = array ("$array[0]" => $array);
Any help with this is greatly apreciated.
Regards Kyle :)
Im having a problem reading CSV data from a text file and storing it in a multidimensional array.
I have a text file like so.
Cathal|kyle@example.com|83.103.100.300|Wednesday 29th August 2007 @ 17:27-13|66023f4984
tony|tonto@example.com|83.107.82.300|Friday 31st August 2007 @ 12:46-49|1c3fd4594d
steve|imapisces@example.com|86.5.147.300|Friday 31st August 2007 @ 17:22-19|d61f895714
I want to take this data and create a multidimensional array from it.
I have been up all night trying various ways like the one shown below but I cant seem to achive what I need it to do.
$fp1 = fopen ("admin/data/pred.txt", 'rb');
while ( $array = fgetcsv ($fp1, 1024, "|")) {
$multi_array[$array[0]] = array ("$array[0]" => $array);
Any help with this is greatly apreciated.
Regards Kyle :)