Has anyone here ever had to work with a
Reynolds and Reynolds system ? they make
auto dealer management software. It is a
closed system, but apparently sites like
autotrader.com access them from various
dealers to extract inventory data...autotrader
appears to use jsp, so I assume that I can
use php as well. if any one has any experience
with anything remotely like this, please let me know

Thanks,

Jerry Lake            - [EMAIL PROTECTED]
Web Designer
Europa Communications - http://www.europa.com
Pacifier Online     - http://www.pacifier.com


-----Original Message-----
From: Plutarck [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 18, 2001 4:59 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Importing Data from Text File


Use file() to read the file up into an array (we'll call it $array).

Then I would personally use:

foreach ($array as $val)
{
     trim($val);
     $arr = explode("\t", $val); // "\t" means tab, but it will not work if
it's only spaces instead of a real tab

     $stock_name = $arr[0];
     $stock_desc = $arr[1];
     $stock_length = $arr[2];
     $stock_qty = $arr[3];
     $stock_price = $arr[4];

     // Do your insert/update SQL query right here, before the ending
bracket.

}


There you go. Now inside that loop you have 5 variables with the values they
should have, ready for you to do whatever you'd like with them.

If your wondering, trim() is used to remove the newline characters and
extraneous spaces from the begining and end of the string. As long as they
are using an actual "tab" button between each piece of data, and only ONE
tab, it works.

Tell me if this works for you. If it doesn't I can rethink it :)


--
Plutarck
Should be working on something...
...but forgot what it was.

"Chris Aitken" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi Everyone,
>
> Ive been asked to do a task here at my work and its something ive never
> done before. I was hoping you guys could point me in the right direction
so
> I can research some more and discover how in the hell im gonna do this :)
>
> Basically, I have been issued a TAB delimited text file which I need to
> process and insert all the data into a table. Here is a basic example of
> what I need to do..........
>
> Say the text file had the following lines (thousands of them, 1 record per
> line)
>
> Screw   Big     12      200     1.99
> Screw   Big     10      400     1.50
>
> And I wanted to import each line into a table (Mysql DB) that had 6 fields
> (5 for each of the above plus an autoincremented ID field
>
> stock_id
> stock_name
> stock_desc
> stock_length
> stock_qty
> stock_price
>
>
> Any suggestions and direction pointing will be greatly appreciated.
>
>
>
>
> --
>        Chris Aitken - Webmaster/Database Designer - IDEAL Internet
> email: [EMAIL PROTECTED]  phone: +61 2 4628 8888  fax: +61 2 4628 8890
>              --------------------------------------------
>
>        Unix -- because a computer's a terrible thing to waste!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to