Hi All,
I have a problem with the following situation:
I have written a program (PHP) about "splitting" an order in an online e-shop system, by copying the order info in a table,
replacing the order number with a new one and insert back to the same table.
Some of the tables are InnoDB and some are MyISAM.
The result is, EXCEPT whole order info, other tables like order items, shipments can be inserted into database.
The order info tables are using InnoDB as storing engine.
My program is used "manual transaction" logic, which means start and end transaction via the program.
The "start transaction" statement is written in a config file.
And part of the code is in below:
(include the config file to start transaction)
...
$insert_order_table1="INSERT INTO orders ";
$insert_order_table2="INSERT INTO orders_shipping ";
$insert_order_table3="INSERT INTO orders_invoice ";
$insert_order_table4="INSERT INTO orders_customer ";
$insert_order_sql.="(total_amount,"; $insert_order_sql.="orderno,firstname,lastname,company,phone,fax,email,saddress1,";
...
$insert_order_query1=mysql_query($insert_order_table1.$insert_order_sql, $dbh) or die(mysql_error());
...
(insertion of other tables like order items )
...
end_transa(xxx);
This case will cause these four tables will not have the record of "0001A",
but for others like order items, the statements can be inserted into mysql.
For example,
suppose the original order number is 0001,
I split the order once to 0001A:
"INSERT INTO orders(orderno, ...) VALUES ('0001A', ...);"
it will got rolled back after end_transa() (end transaction) in result.
But when the program executes:
"INSERT INTO orderitems(orderno, itmeno, ...) VALUES ('0001A', 'Item A', ...);"
it can be inserted into mysql and can be searched then...
But I discovered that when I put these insert order info statements just before end_transa(),
the problem stated above will not happen (even put them after some tables, the order info still disappeared in the database).
I want to know the reason of causing this problem,
so is it related to some settings of mysql system variable?
If yes, which parameters should I notice?
Can anyone help me? Thanks a lot!
P.S. I come from Hong Kong and I'm sorry for my bad English...
Raymond
I have a problem with the following situation:
I have written a program (PHP) about "splitting" an order in an online e-shop system, by copying the order info in a table,
replacing the order number with a new one and insert back to the same table.
Some of the tables are InnoDB and some are MyISAM.
The result is, EXCEPT whole order info, other tables like order items, shipments can be inserted into database.
The order info tables are using InnoDB as storing engine.
My program is used "manual transaction" logic, which means start and end transaction via the program.
The "start transaction" statement is written in a config file.
And part of the code is in below:
(include the config file to start transaction)
...
$insert_order_table1="INSERT INTO orders ";
$insert_order_table2="INSERT INTO orders_shipping ";
$insert_order_table3="INSERT INTO orders_invoice ";
$insert_order_table4="INSERT INTO orders_customer ";
$insert_order_sql.="(total_amount,"; $insert_order_sql.="orderno,firstname,lastname,company,phone,fax,email,saddress1,";
...
$insert_order_query1=mysql_query($insert_order_table1.$insert_order_sql, $dbh) or die(mysql_error());
...
(insertion of other tables like order items )
...
end_transa(xxx);
This case will cause these four tables will not have the record of "0001A",
but for others like order items, the statements can be inserted into mysql.
For example,
suppose the original order number is 0001,
I split the order once to 0001A:
"INSERT INTO orders(orderno, ...) VALUES ('0001A', ...);"
it will got rolled back after end_transa() (end transaction) in result.
But when the program executes:
"INSERT INTO orderitems(orderno, itmeno, ...) VALUES ('0001A', 'Item A', ...);"
it can be inserted into mysql and can be searched then...
But I discovered that when I put these insert order info statements just before end_transa(),
the problem stated above will not happen (even put them after some tables, the order info still disappeared in the database).
I want to know the reason of causing this problem,
so is it related to some settings of mysql system variable?
If yes, which parameters should I notice?
Can anyone help me? Thanks a lot!
P.S. I come from Hong Kong and I'm sorry for my bad English...
Raymond