Re: Transaction suddenly not working
| From: | denys | Date: | Mon, 29 Nov 2004 12:59:10 +0000 |
| Subject: | Re: Transaction suddenly not working | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37437@lists.php.net to get a copy of this message | ||
Stuart Felenstein a écrit :
--- Stuart Felenstein <stuart4m@yahoo.com> wrote:what if you try to ignore the primary key in fields and values list ? MySQL should assign a valid primary key. It's what I'm doing on 4.0.22 and it's working.... If not, try to echo your query and write it in MySQL( GUI or console).I know recently the server was update from PHP 4.3.8 to 4.3.9 but that shouldn't have effected anything. Code: $query = "INSERT INTO table1 (ProfileID, LurkID, ProfileName, Edu,..................." VALUES (null,......................." ProfileID is the PrimaryID (autoinc) - I've set the input value to null for the auto-inc to properly work. I assume this is correct and it did work at one time. Then before the next query: $LID = mysql_insert_id(); Then each subsequent query uses $LID in the subsequent tables. However $LID is now returning 0 and the transaction fails. At the end of the transaction I follow through with this: //resx = all the queries if($res1 && $res2 && $res3 && $res4 && $res5 && $res6 && res7 ) // If all results are true { commit(); //echo "your insertions were successful"; unset($all session variable, $LID, ); }else{ ................... Puzzling since this script was working great. We did also upgrad MySQL from 4.0.21 to 4.0.22-standardI wanted to add - I realize that if there is an error in the first query (where the id is generated) it would result in a value of 0 I've echoed out the query and am seeing this: "Duplicate entry '0-i' for key 1 transaction failed" Never seen a 0-i before. Stuart hi!