•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,555 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,492 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1670 | Replies: 3
![]() |
•
•
Join Date: Sep 2007
Posts: 18
Reputation:
Rep Power: 2
Solved Threads: 0
Hello everyone,
I have a bit of a problem. I am in the middle of developing a site that needs to use transactions. I have several different tables that comprise a single insert form. Table A, B and C all require transactions.
From what I understand, mysql_query does not support multiple queries. I have several problems that I will list.
1. autocommit is turned off and my script needs to issue "COMMIT"
2. mysql_insert_id() will NOT get the last id until the COMMIT has been issued so returns false.
Basically, I cannot insert data into table B without first knowing the last_id from table A.
I can't get around how to accomplish this.
Can someone please give a hand?
Thanks,
Tom
I have a bit of a problem. I am in the middle of developing a site that needs to use transactions. I have several different tables that comprise a single insert form. Table A, B and C all require transactions.
From what I understand, mysql_query does not support multiple queries. I have several problems that I will list.
1. autocommit is turned off and my script needs to issue "COMMIT"
2. mysql_insert_id() will NOT get the last id until the COMMIT has been issued so returns false.
Basically, I cannot insert data into table B without first knowing the last_id from table A.
I can't get around how to accomplish this.
Can someone please give a hand?
Thanks,
Tom
•
•
Join Date: Jun 2007
Location: Valley Center, Kansas
Posts: 643
Reputation:
Rep Power: 3
Solved Threads: 72
did you try to insert empty record then assign it
for example:
$RecID = '1001';
$Table1 = "your sql code where ID=$RecID";
mysql_query($Table1);
$Table2 = ....
...
$Table3 = ....
....
on error, delete the record
i do in this way.
for example:
$RecID = '1001';
$Table1 = "your sql code where ID=$RecID";
mysql_query($Table1);
$Table2 = ....
...
$Table3 = ....
....
on error, delete the record
i do in this way.
Last edited by fatihpiristine : Oct 20th, 2007 at 4:20 pm.
Do a favour, leave me alone
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- how to connect vb6.0 to oracle 9i (Visual Basic 4 / 5 / 6)
- MySQL Checkbox Multiple data Delete? (PHP)
- Help With Registration Form (JSP)
- How to pre-select checkboxes in form? (PHP)
- URGENT: Implementing search with multiple dissimilar MySQL tables (MySQL)
- MySQL Multiple Table Search (MySQL)
- Hosting multiple Apache/PHP/mysql sites - how many? (Linux Servers and Apache)
- Choose suitable database package (Visual Basic 4 / 5 / 6)
Other Threads in the PHP Forum
- Previous Thread: Automatic execution of php
- Next Thread: PLease HELP(newsletter)


Linear Mode