Re: [PHP-DB] Strange MySQL problem with multiple consequent inserts

2001-05-14 Thread Stefano Bizzi

Thanks... but that's is just a copy & paste mistake... the original one
doesnt... :)
infact the query runs and insert the $DATA field correctly

Thanks :)

Stefano

""Brian S. Dunworth"" <[EMAIL PROTECTED]> ha scritto nel messaggio
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> At 05:56 PM 5/14/01 +0200, Stefano Bizzi wrote:
> >$result = mysql_query ("INSERT INTO Ordini (ORDERID, DATA, RAGSOC,
> >INDIRIZZO, CAP, CITTA, PROVINCIA, NAZIONE, EU, TELEFONO, FAX, EMAIL,
ICQUIN,
> >PARTITAIVA, MODPAGAMENTO, IP) VALUES ('$ORDERID', $DATA',
>
>You're missing the opening single quote on $DATA ^^^
>
>
> >'$RAGIONESOCIALE',
> >'$INDIRIZZO', '$CAP', '$CITTA', '$PV', 'IT', 1, '$TELEFONO', '$FAX',
> >'$EMAIL', '$ICQUIN', '$PIVACFISC', '$PAYMENT', '$CURRENTIP')", $db) or
die
> >("wrong query : " . mysql_error());
> >  print "Ordini Table : Insert ID : " . mysql_insert_id();
> >print "Result : $result";
> >foreach ($dettaglio as $elemento)
> >{
> >$parti = explode("|", $elemento);
> >$result = mysql_query ("INSERT INTO Dettaglio (ORDERID, PARTID,
> >DESCRIZIONE, PREZZOIE, ALIVA) VALUES ('$ORDERID', '$parti[0]',
'$parti[1]',
> >'$parti[2]', '20')", $db) or die (mysql_error());
> >print "Detail Table - Insert ID : " . mysql_insert_id();
> >print "Result : $result";
> > }
> >
> >is supposed to add several records to my MySQL table. As you notice, it
is
> >written to add a first record (order record) and a subset of records
realted
> >to that order (in the foreach cycle). I tried with 1 order and 5 details,
> >and add OR the order OR the details (always all the detail records are
added
> >in this case)... never both together. The strange thing is that the
output
> >to the browser is the following:
> >
> >Ordini Table : Insert ID : 0
> >Result : 1
> >Detail Table - Insert ID : 1
> >Result : 1
> >Detail Table - Insert ID : 2
> >Result : 1
> >Detail Table - Insert ID : 3
> >Result : 1
> >Detail Table - Insert ID : 4
> >Result : 1
> >Detail Table - Insert ID : 5
> >Result : 1
> >
> >So, from what i can understand, the queries are issued correctly (result
is
> >always true) and also the insert_id is updated correctly. What could
cause
> >the random insert of the records?
> >
> >Thanks in advance for any suggestion :)
> >
> >Stefano
> >
> >
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>   -
> Brian S. Dunworth
> Sr. Software Development Engineer
> Oracle Database Administrator
> The Printing House, Ltd.
>
> (850) 875-1500  x225
> <[EMAIL PROTECTED]>
>   -
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] Strange MySQL problem with multiple consequent inserts

2001-05-14 Thread Brian S. Dunworth

At 05:56 PM 5/14/01 +0200, Stefano Bizzi wrote:
>$result = mysql_query ("INSERT INTO Ordini (ORDERID, DATA, RAGSOC,
>INDIRIZZO, CAP, CITTA, PROVINCIA, NAZIONE, EU, TELEFONO, FAX, EMAIL, ICQUIN,
>PARTITAIVA, MODPAGAMENTO, IP) VALUES ('$ORDERID', $DATA',

   You're missing the opening single quote on $DATA ^^^


>'$RAGIONESOCIALE',
>'$INDIRIZZO', '$CAP', '$CITTA', '$PV', 'IT', 1, '$TELEFONO', '$FAX',
>'$EMAIL', '$ICQUIN', '$PIVACFISC', '$PAYMENT', '$CURRENTIP')", $db) or die
>("wrong query : " . mysql_error());
>  print "Ordini Table : Insert ID : " . mysql_insert_id();
>print "Result : $result";
>foreach ($dettaglio as $elemento)
>{
>$parti = explode("|", $elemento);
>$result = mysql_query ("INSERT INTO Dettaglio (ORDERID, PARTID,
>DESCRIZIONE, PREZZOIE, ALIVA) VALUES ('$ORDERID', '$parti[0]', '$parti[1]',
>'$parti[2]', '20')", $db) or die (mysql_error());
>print "Detail Table - Insert ID : " . mysql_insert_id();
>print "Result : $result";
> }
>
>is supposed to add several records to my MySQL table. As you notice, it is
>written to add a first record (order record) and a subset of records realted
>to that order (in the foreach cycle). I tried with 1 order and 5 details,
>and add OR the order OR the details (always all the detail records are added
>in this case)... never both together. The strange thing is that the output
>to the browser is the following:
>
>Ordini Table : Insert ID : 0
>Result : 1
>Detail Table - Insert ID : 1
>Result : 1
>Detail Table - Insert ID : 2
>Result : 1
>Detail Table - Insert ID : 3
>Result : 1
>Detail Table - Insert ID : 4
>Result : 1
>Detail Table - Insert ID : 5
>Result : 1
>
>So, from what i can understand, the queries are issued correctly (result is
>always true) and also the insert_id is updated correctly. What could cause
>the random insert of the records?
>
>Thanks in advance for any suggestion :)
>
>Stefano
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

  -
Brian S. Dunworth
Sr. Software Development Engineer
Oracle Database Administrator
The Printing House, Ltd.

(850) 875-1500  x225
<[EMAIL PROTECTED]>
  -


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]