Reynolds & Reynolds - php use
| From: | Jerry Lake | Date: | Wed, 18 Apr 2001 18:42:15 +0000 |
| Subject: | Reynolds & Reynolds - php use | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49245@lists.php.net to get a copy of this message | ||
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 - jerryl@europa.com
Web Designer
Europa Communications - http://www.europa.com
Pacifier Online - http://www.pacifier.com
-----Original Message-----
From: Plutarck [mailto:aemuli@spamclause-yahoo.com]
Sent: Wednesday, April 18, 2001 4:59 AM
To: php-general@lists.php.net
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" <chris@ideal.net.au> wrote in message
news:5.0.2.1.2.20010418144017.02ab95f0@mail.ideal.net.au...
> 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: chris@ideal.net.au 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: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net