(no subject)
Jul. 14th, 2010 08:51 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
PHP/MySQL question.
There is a tab-separated file that contains, among other things, true/false values.
I run this from the command line:
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:
WRYYYYYYYy
Originally posted on Dreamwidth. Number of comments so far:
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:
(no subject)
Date: 2010-07-15 05:48 am (UTC)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.
(no subject)
Date: 2010-07-15 07:05 am (UTC)I tracked down something that said going from [some data type] to boolean to varchar resulted in doom, but it is too late o'clock for me to think right now. I recall their opinion being to change the data type of the destination column to char, and hopefully that'd help.