Hi List.

I have been working on a problem that is driving me crazy.

I have to create a process in which I upload some info to a table. Since I
have to add some different information to that table, I decided to do it
like this.

1.I create a temporary table copying the structure of my final table. I.E.
$query_temp_table="CREATE TEMPORARY TABLE tguias SELECT * FROM guias WHERE
1=0";
$temp_table=mysql_query($query_temp_table, $cosmo_logistic) or
die(mysql_error());
I do this in PHP.
It works fine It seems.
2. I populate the temporary table.
$query_populate_tguias="LOAD DATA LOCAL INFILE
'c:/cosmo/www/upload/guias.txt' INTO TABLE tguias FIELDS TERMINATED BY ','
ENCLOSED BY '\"'
(cliente,asesora,extra1,peso,albaran,gerente,tipo,imprimir)";
$populate_tguias=mysql_query($query_populate_tguias, $cosmo_logistic) or
die(mysql_error());
3. Then I pass the information along with some other variables to the real
table.
mysql_select_db($database_cosmo_logistic, $cosmo_logistic);
$query_poblar = "SELECT * FROM tguias";
$poblar = mysql_query($query_poblar, $cosmo_logistic) or die(mysql_error());
$row_poblar= mysql_fetch_assoc($poblar);
$totalRows_poblar= mysql_num_rows($poblar);
   do { 
        mysql_select_db($database_cosmo_logistic, $cosmo_logistic);
        $query_poblar_guias="INSERT INTO guias
(cliente,asesora,peso,albaran,gerente,tipo,imprimir,manifiesto,Status)
VALUES
(\"".$row_poblar['cliente']."\",\"".$row_poblar['asesora']."\",".$row_poblar
['peso'].",\"".$row_poblar['albaran']."\",\"".$row_poblar['gerente']."\",\""
.$row_poblar['tipo']."\",".$row_poblar['imprimir'].",\"".$manifiesto."\",\"A
\")";
        $poblar_guias=mysql_query($query_poblar_guias, $cosmo_logistic) or
die("No pude insertar el registro ".mysql_error());
        } while ($row_poblar=mysql_fetch_assoc($poblar));?>

with this source file:
"13DAN010","D79406","13DAN010", 1 ,"20430002201","75301;753","PAQUETE","1"
"13DAN010","D55816","13DAN010", 1.32
,"20430003101","100201;1002","PAQUETE","1"

it Does not work at all. I wonder if it is because it has a . in the number
even as the field receiving it is a decimal(10,2) or if it is because in one
of the field I have ;. 

The thing is that it will import one, and skip one full record each time.
But the one it inserts, is correctly inserted with the ; and the decimal
point correct. Any idea why it might be pasing one row and adding one?

This is driving me crazy.

When I do this same procedure on another table with source code like: 
"D79427","LOPEZ DURAN ELISA","ACUEDUCTO TARRAGONA 59","15","PASEOS DEL
BOSQUE","NAUCALPAN","53297"," ","LOPEZ DURAN ELISA","",F,T

it Works correctly even as it has two false or true fields.







---------------------------------------------------------------------
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

Reply via email to