RE: [PHP] load data infile

2004-07-16 Thread Jay Blanchard
[snip]
I have a tab delimited file I am trying to load in my database using:

LOAD DATA INFILE '/users/dbs/sites/phpmyadmin/gus/exptab.txt' INTO TABLE
datable;

But all it will load is the first record and I have about 2000 records.
There are 20 columns of data in my 'exptab.txt' file I am loading and
there are 20 fields in datable.
[/snip]

Have you, by any chance, consulted the MySQL list?
http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html ?

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



Re: [PHP] Load Data infile

2004-05-13 Thread Matt Matijevich
[snip]
I need do load data infile in mysql:
$query_string2 = LOAD DATA INFILE '/var/www/xls/test' REPLACE INTO
TABLE
`test` FIELDS TERMINATED BY ',' ENCLOSED BY '\' ESCAPED BY '\\' LINES
TERMINATED BY '\n';$query_db_string2 = mysql_query($query_string2);
But not realize nothing with execution the script.
[/snip]

have you checked mysql_error() ?

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



Re: [PHP] Load Data infile

2004-05-13 Thread Juan Pablo Herrera
 [snip]
 I need do load data infile in mysql:
 $query_string2 = LOAD DATA INFILE '/var/www/xls/test' REPLACE INTO
 TABLE
 `test` FIELDS TERMINATED BY ',' ENCLOSED BY '\' ESCAPED BY '\\' LINES
 TERMINATED BY '\n';$query_db_string2 = mysql_query($query_string2);
 But not realize nothing with execution the script.
 [/snip]

 have you checked mysql_error() ?

yes,
You have an error in your SQL syntax near ''' at line 2
but i change '\' and not work.

Thank you,

Juan Pablo

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



Re: [PHP] Load Data infile

2004-05-13 Thread John W. Holmes
Juan Pablo Herrera wrote:

[snip]
I need do load data infile in mysql:
$query_string2 = LOAD DATA INFILE '/var/www/xls/test' REPLACE INTO
TABLE
`test` FIELDS TERMINATED BY ',' ENCLOSED BY '\' ESCAPED BY '\\' LINES
TERMINATED BY '\n';$query_db_string2 = mysql_query($query_string2);
But not realize nothing with execution the script.
[/snip]
have you checked mysql_error() ?


yes,
You have an error in your SQL syntax near ''' at line 2
but i change '\' and not work.
The problem is PHP parses the string before it's passed to MySQL.

Since you're using double quotes

ESCAPED BY '\\' LINES

is parsed to

ESCAPED BY '\' LINES

by PHP and then sent to MySQL, which causes an error.

Two solutions:

'ESCAPED BY \'\\\' LINES' (use single quotes)

or

ESCAPED BY '' LINES

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com

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


Re: [PHP] Load Data Infile

2002-12-29 Thread Marco Tabini
I'm not sure how MySQL works under Windows, but you should either use
double backslashes (\\) instead of single backslashes or use forward
slashes (/) instead. MySQL is trying to escape your string.

Cheers,


Marco
-- 

php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!

---BeginMessage---
Off topic but I hope somebody can help.

Using MS Win98 / mySQL.

I'm trying to use LOAD DATA INFILE and coming up empty.

My text file is named:

test.txt
..

and is stored in C:\TextFiles

on the command line I type:
..
mysql  LOAD DATA INFILE C:\TextFiles\test.txt INTO TABLE tony;

...
I get:

ERROR 1105 File c:\TextFile\ est.txt not found (Errcode:2)

\\please note that the t in test is not there.

Any help would be greatly appreciated.
Happy holidays,
Tony Ritter



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



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


Re: [PHP] Load Data Infile

2002-12-29 Thread Anthony Ritter
Marco Tabini [EMAIL PROTECTED] wrote in message:

 I'm not sure how MySQL works under Windows, but you should either use
 double backslashes (\\) instead of single backslashes or use forward
 slashes (/) instead. MySQL is trying to escape your string.

 Cheers,
 Marco


Thanks Marco.

C:\\TextFiles\\test.txt

works now

Happy new year to you and yours...
TR




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




RE: [PHP] Load data infile

2002-05-14 Thread Jay Blanchard

[snip]
Is it possible to do the load data info mysql command via PHP

I get an access denied error from mysql when i try to do that.
[/snip]

Are the permissions granted properly for the PHP user in the connection
statement?

Jay



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




Re: [PHP] Load data infile

2002-05-14 Thread Dennis Moore

You may want to check permissions within your database.  The web server user
may not have permissions to perform this action.

/dkm

- Original Message -
From: [EMAIL PROTECTED]
To: Philip Hallstrom [EMAIL PROTECTED]
Cc: Peter J. Schoenster [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, May 14, 2002 6:53 PM
Subject: [PHP] Load data infile


 Hello,

 Is it possible to do the load data info mysql command via PHP


 I get an access denied error from mysql when i try to do that.



 Thanks


 Randy








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


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