RE: [PHP-DB] How to insert to DB from txt??? Please help

2002-01-07 Thread Leotta, Natalie (NCI/IMS)

That's why I skipped the regular expression and irregular expression and
grep stuff and used explode :-)  All it takes is the string and the
delimiter and it feeds you back an array.  I've been using it to pass
parameters in the $QUERY_STRING when I don't use $HTTP_POST_VARS.  You can
even have strings within it that are delimited by something else.  I put
everything together with s and then if there's a group of things in there
that I want to keep together I use @.  It works well.

Does this answer your question?  I'm still new to PHP (I think I started in
Oct. or Nov.) but that's basically all I've been doing since then.  That's
why I've tried to stick with the methods that make the most sense and cut
down on some of my learning curve :-)

Good luck!

-Natalie

 -Original Message-
 From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Sent: Friday, January 04, 2002 6:53 PM
 To:   Leotta, Natalie (NCI/IMS)
 Cc:   'Kelvin'; [EMAIL PROTECTED]
 Subject:  RE: [PHP-DB] How to insert to DB from txt??? Please help
 
 egrep_split?  But then, there's the learning curve for grep...
 
 On Fri, 4 Jan 2002, Leotta, Natalie (NCI/IMS) wrote:
 
  There are a few ways to split up text based on a delimiter.  I recommend
 you
  look at split and explode on the PHP.net site and see what seems to be
 best
  for your situation.  Once you go to one of them they link you to other
  functions that do similar things.  I believe explode is faster but I
 can't
  remember for sure.
 
  -Natalie
 
   -Original Message-
   From: Kelvin [SMTP:[EMAIL PROTECTED]]
   Sent: Friday, January 04, 2002 11:44 AM
   To:   [EMAIL PROTECTED]
   Subject:  [PHP-DB] How to insert to DB from txt??? Please help
  
   Hi everyone,
  
   I have a txt file which is contained the following:
  
 ,aaa,ccc,ddd
 ,aaa,ccc,ddd
 .etc.
  
  Now, I need to read the data from that file and than insert it into
 the
   table.
  
  insert into Table (name,pass,phone,somethingelse)
  
  Could someone help me out here, How to write the code?
  I know how to read from a txt file, but I don't know how to
 separate
   the
   data determine by ,
  
  Please help, I'll be very appreciate.Thanks
  
   Kelvin.
  
  
  
  
   --
   PHP Database 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 Database 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 Database 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]




RE: [PHP-DB] How to insert to DB from txt??? Please help

2002-01-04 Thread Nally, Tyler G.

How about

LOAD DATA INFILE 'filename.txt'
INTO TABLE Table
FIELDS TERMINATED BY ','    comma delimited for tabs use '\t'
LINES TERMINATED BY '\n'    *nix line terminator, for Dos/Win use
'\r\n'
IGNORE 1 LINES  use if the first line of the file has col.
hdrs.
  (column1name, column2name, column3name, column4name);

--
__   _Tyler Nally
   / /__   _(_)___       _ _  [EMAIL PROTECTED]
  / / _ \/ __ `/ / __ \/ __ \ / __ \/ ___/ __ `/  317-860-3016
 / /  __/ /_/ / / /_/ / / / // /_/ / /  / /_/ /   American Legion Website
/_/\___/\__, /_/\/_/ /_(_)/_/   \__, /http://www.legion.org
   //  //   

 -Original Message-
 From: Kelvin [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 04, 2002 11:44 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] How to insert to DB from txt??? Please help
 
 
 Hi everyone,
 
 I have a txt file which is contained the following:
 
   ,aaa,ccc,ddd
   ,aaa,ccc,ddd
   .etc.
 
Now, I need to read the data from that file and than 
 insert it into the
 table.
 
insert into Table (name,pass,phone,somethingelse)
 
Could someone help me out here, How to write the code?
I know how to read from a txt file, but I don't know how 
 to separate the
 data determine by ,
 
Please help, I'll be very appreciate.Thanks
 
 Kelvin.
 
 
 
 
 -- 
 PHP Database 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 Database 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]




Re: [PHP-DB] How to insert to DB from txt??? Please help

2002-01-04 Thread Jason Wong

On Saturday 05 January 2002 00:44, Kelvin wrote:
 Hi everyone,

 I have a txt file which is contained the following:

   ,aaa,ccc,ddd
   ,aaa,ccc,ddd
   .etc.

Now, I need to read the data from that file and than insert it into the
 table.

insert into Table (name,pass,phone,somethingelse)

Could someone help me out here, How to write the code?
I know how to read from a txt file, but I don't know how to separate the
 data determine by ,

Use explode(). For example:

 $line = ,aaa,ccc,ddd;
 $bits = explode(,, $line);

Would result in:

 $bits[0] = 
 $bits[1] = aaa
 $bits[2] = ccc etc.

hth
-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Love conquers all things; let us too surrender to love.
-- Publius Vergilius Maro (Virgil)
*/

-- 
PHP Database 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]




RE: [PHP-DB] How to insert to DB from txt??? Please help

2002-01-04 Thread ted

egrep_split?  But then, there's the learning curve for grep...

On Fri, 4 Jan 2002, Leotta, Natalie (NCI/IMS) wrote:

 There are a few ways to split up text based on a delimiter.  I recommend you
 look at split and explode on the PHP.net site and see what seems to be best
 for your situation.  Once you go to one of them they link you to other
 functions that do similar things.  I believe explode is faster but I can't
 remember for sure.

 -Natalie

  -Original Message-
  From:   Kelvin [SMTP:[EMAIL PROTECTED]]
  Sent:   Friday, January 04, 2002 11:44 AM
  To: [EMAIL PROTECTED]
  Subject:[PHP-DB] How to insert to DB from txt??? Please help
 
  Hi everyone,
 
  I have a txt file which is contained the following:
 
,aaa,ccc,ddd
,aaa,ccc,ddd
.etc.
 
 Now, I need to read the data from that file and than insert it into the
  table.
 
 insert into Table (name,pass,phone,somethingelse)
 
 Could someone help me out here, How to write the code?
 I know how to read from a txt file, but I don't know how to separate
  the
  data determine by ,
 
 Please help, I'll be very appreciate.Thanks
 
  Kelvin.
 
 
 
 
  --
  PHP Database 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 Database 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 Database 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]




Re: [PHP-DB] How to insert to DB from txt??? Please help

2002-01-04 Thread Steven Dowd

you should maybe try the free dbtools mysql program from
http://www.dbtools.com.br
this can handle text file imports direct into a mysql db , also it can
import or export from excell , access, paradox, foxpro , dbase or odbc data
sources, very handy tool if all you ever use it for is the transfer of
datatypedatatype..

Steven

- Original Message -
From: Kelvin [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 04, 2002 4:44 PM
Subject: [PHP-DB] How to insert to DB from txt??? Please help


 Hi everyone,

 I have a txt file which is contained the following:

   ,aaa,ccc,ddd
   ,aaa,ccc,ddd
   .etc.

Now, I need to read the data from that file and than insert it into the
 table.

insert into Table (name,pass,phone,somethingelse)

Could someone help me out here, How to write the code?
I know how to read from a txt file, but I don't know how to separate
the
 data determine by ,

Please help, I'll be very appreciate.Thanks

 Kelvin.




 --
 PHP Database 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 Database 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]