php-db | 2001051
Date: 05/14/01
- Next message: John Lim: "Re: [PHP-DB] Performance of Stored Procedures ?"
- Previous message: Stefano Bizzi: "[PHP-DB] Strange MySQL problem with multiple consequent inserts"
- In reply to: Stefano Bizzi: "[PHP-DB] Strange MySQL problem with multiple consequent inserts"
- Next in thread: Stefano Bizzi: "Re: [PHP-DB] Strange MySQL problem with multiple consequent inserts"
- Reply: Stefano Bizzi: "Re: [PHP-DB] Strange MySQL problem with multiple consequent inserts"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 "<BR>Ordini Table : Insert ID : " . mysql_insert_id();
>print "<BR>Result : $result<BR>";
>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 "<BR>Detail Table - Insert ID : " . mysql_insert_id();
> print "<BR>Result : $result<BR>";
> }
>
>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: php-db-unsubscribe <email protected>
>For additional commands, e-mail: php-db-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>
-------------------------------------
Brian S. Dunworth
Sr. Software Development Engineer
Oracle Database Administrator
The Printing House, Ltd.
(850) 875-1500 x225
<brian <email protected>>
-------------------------------------
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: John Lim: "Re: [PHP-DB] Performance of Stored Procedures ?"
- Previous message: Stefano Bizzi: "[PHP-DB] Strange MySQL problem with multiple consequent inserts"
- In reply to: Stefano Bizzi: "[PHP-DB] Strange MySQL problem with multiple consequent inserts"
- Next in thread: Stefano Bizzi: "Re: [PHP-DB] Strange MySQL problem with multiple consequent inserts"
- Reply: Stefano Bizzi: "Re: [PHP-DB] Strange MySQL problem with multiple consequent inserts"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

