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.
I want to take this data and create a multidimensional array from it.Code: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 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.
Any help with this is greatly apreciated.Code:$fp1 = fopen ("admin/data/pred.txt", 'rb'); while ( $array = fgetcsv ($fp1, 1024, "|")) { $multi_array[$array[0]] = array ("$array[0]" => $array);
What I am trying to achive is search the text file by the username variable (the first value from each line of the text file) and be able to access just that lines info.
Regards Kyle![]()



Reply With Quote

Bookmarks