Tricky explode(), help please!



Hello Everyone,

I have a situation that I just cannot wrap my head around. I would
appreciate any ideas or suggestions.

I am trying to parse and load a tab delimited file into a mysql
database. The file is generated by a scientific instrument. One file
contains the records of several people. Each person's information is
in 3 consecutive lines of the file.

A simplified demonstration:

id | test | result
1 | test1 | 50
| test 2 | 55
| test 3 | 60
2 | test 1 | 10
| test 2 | 15
| test 3 | 20
etc.

When I load this information into the database, it should have this
format
id | test 1 | test 2 | test 3
1 | 50 | 55 | 60
2 | 10 | 15 | 20

I'm okay with setting up the database, that's no problem.

I am however rather new to PHP and although I know I have to use the
explode() function to break this array down into its parts, I'm not
exactly sure how. Specifically, one file could contain the records of
up to 20 people, and I am not sure how I can loop through this file
(loaded into an array) in order to capture all of this info.

I hope I've given enough information to make sense. Again, any ideas,
examples or suggestions would be appreciated.

Thanks,
Andy

.



Relevant Pages

  • Re: Check if any items in an array (php) is in a table (mysql).
    ... I want to check the ship record (a table in a MySQL database) to check ... I could brute force it and increment through the "to be shipped array" ... Load the shipped table as an associative array and then do an isseton the $arrayin question. ...
    (comp.lang.php)
  • Re: Tricky explode(), help please!
    ... When I load this information into the database, ... explodefunction to break this array down into its parts, ... and load output file when all rows have been ...
    (comp.lang.php)
  • Re: System.Drawing.Image.FromFile leaves file open longer than necessary: bug?
    ... load on the system when it finally does it by itself. ... > dispose the stream as soon as you are done reading it. ... database. ... stream out of the same array for copying into the picturebox, ...
    (microsoft.public.dotnet.framework.clr)
  • Re: SQL Server, MS Word and C#.
    ... You should be able to load your document into an array, ... > I want to insert some word files into the database and also be able to> retreive them. ... > 1) What DataType should the fiel be in the DB. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Function to load file as associate array?
    ... > Is there a function that does this in one shot, or do I have to load the ... No, you will have to parse it yourself., e.g. with: ... $array = array; ...
    (alt.php)