[PHP-DB] Parsing Tab Delimited file

2010-10-24 Thread Ethan Rosenberg

Dear list -

Thanks for all your help.

I have a tab delimited file which I wish to import into a data 
base.  In MySQL I can use the LOAD DATA command.  As far as I know, 
that command cannot be used in PHP as a mysqli_query.  As I 
understand, I have to parse the file and use the INSERT command.


How do I do it?  Code samples, please.

Thanks.

Ethan



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Parsing Tab Delimited file

2010-10-24 Thread Jason Pruim


On Oct 24, 2010, at 2:46 PM, Ethan Rosenberg wrote:


Dear list -

Thanks for all your help.

I have a tab delimited file which I wish to import into a data  
base.  In MySQL I can use the LOAD DATA command.  As far as I know,  
that command cannot be used in PHP as a mysqli_query.  As I  
understand, I have to parse the file and use the INSERT command.


How do I do it?  Code samples, please.

Thanks.


http://tinyurl.com/2fnm48f



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Parsing Tab Delimited file

2010-10-24 Thread Andrés G . Montañez
Hi Ethan,

fist you need to read the file, you could use the file() function
which reads the file as an array, being each line an element;
the you have to navigate the array and exploding the lines into an array:

$data = file('myfile.txt');

foreach ($data AS $row) {
  $row = explode(\n, trim($row));
  var_dump($row);
}

And there you go.

Cheers.

On 24 October 2010 16:46, Ethan Rosenberg eth...@earthlink.net wrote:
 Dear list -

 Thanks for all your help.

 I have a tab delimited file which I wish to import into a data base.  In
 MySQL I can use the LOAD DATA command.  As far as I know, that command
 cannot be used in PHP as a mysqli_query.  As I understand, I have to parse
 the file and use the INSERT command.

 How do I do it?  Code samples, please.

 Thanks.

 Ethan



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
Andrés G. Montañez
Zend Certified Engineer
Montevideo - Uruguay

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Parsing Tab Delimited file

2010-10-24 Thread Niel Archer
 Dear list -
 
 Thanks for all your help.
 
 I have a tab delimited file which I wish to import into a data 
 base.  In MySQL I can use the LOAD DATA command.  As far as I know, 
 that command cannot be used in PHP as a mysqli_query.  As I 
 understand, I have to parse the file and use the INSERT command.

It can be done, IF the MySQL server allows you to do it.. Check the
servers configuration.

 How do I do it?  Code samples, please.
 
 Thanks.
 
 Ethan
 
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

--
Niel Archer
niel.archer (at) blueyonder.co.uk



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Creating an INDEX on multiple tables?

2010-10-24 Thread Chris

On 22/10/10 21:00, Ron Piggott wrote:

I have moved the GROUP BY outside now Chris.

In the queries that make up the UNION ALL (such as below) is there a way
to only SELECT matches that are 70% or greater based on the users input?
Right now each and every listing is a search result.


http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html

has info about doing that sort of thing.

--
Postgresql  php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php