nonethefewer: (Default)
[personal profile] nonethefewer
PHP/MySQL question.

There is a tab-separated file that contains, among other things, true/false values.

I run this from the command line:

mysqlimport -v --fields-terminated-by='\t' --fields-optionally-enclosed-by="'" --lines-terminated-by='\n' --user=user --password=password dbname filename.csv

The true/false values are updated fine.

I do the exact same damn thing from PHP, and all true/false columns are set to false.

What gives?

[eta] Same if I run this in PHP:

mysql_query("LOAD DATA INFILE '$file' INTO TABLE table_name FIELDS TERMINATED BY '\t' ENCLOSED BY \"'\" LINES TERMINATED BY '\n'");

WRYYYYYYYy

Originally posted on Dreamwidth.  Number of comments so far: comment count unavailable

(no subject)

Date: 2010-07-15 05:48 am (UTC)
siderea: (Default)
From: [personal profile] siderea
No idea. If I were going to make a guess, I would investigate:

1) whether "ENCLOSED BY \"'\"" actually does equal "--fields-optionally-enclosed-by="'"", particularly the optional part, and

2) Whether the escaping \"'\" was doing the right thing, especially if you magic quotes on or something.

February 2022

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728     

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 26th, 2025 02:20 pm
Powered by Dreamwidth Studios