On fredag, dec 27, 2002, at 16:19 Europe/Copenhagen, Paul DuBois wrote:
At 15:18 +0100 12/27/02, Jonas C. Voss wrote:Based on that last statement, it sounds as though you're still loadingActually, I tried a plethora of formats including the following:1139 113900 1.139,00 1,139.00 1139,00 1139.00 But MySQL interprets them all as 1.13.
the original file and not the transformed version. There is no way that
MySQL will interpret *all* those values as 1.13.
In any case, the values you end up loading should use '.' for the decimal
point, and should not contain any commas at all.
Ok, thanks.
Blast, you are right! Well, sort of. I replace the content of $uploadfile with $cleaned_file here:Inserting '1139' via CLI or phpMyAdmin works as expected, I get a price of '1139.00'.Looks like you upload a file to $upload_file, transform its contents
Is this an issue anybody dealt with before? I'd be happy to hear your findings on the matter.
The code I wrote for importing the text-file can be found here:
<http://xslt.it-c.dk/~jcv/usenet/tusindfryd.phps>
to $cleaned_file, and then attempt to use LOAD DATA with ... $upload_file!
(rather than the transformed file).
# truncates the file pointer:
ftruncate($fd,0);
# writes content of $cleaned_file to file pointer $fd:
fwrite($fd, $cleaned_file);
But, I didn't put a + in my file pointer, so the file was only readable, not writeable, see?
$fd = fopen ($uploadfile, "r");
Egad I feel stupid. Thanks for pointing me in the right direction, it works perfectly now. :)
--
// Jonas C. Voss // http://verture.net/ //
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php