Jump to content

Transaction commits but then SELECT statement fails


TheFilmGod

Recommended Posts

I am ripping my hair out because I've been trying to resolve this issue for the past 2 hours now and I have not made an progress.

 

Basically, I have a transaction that inserts a record and updates another table. I commit the transaction.

 

Then, php does some work and issues a SELECT statement.

 

The select statement fails. At first I had to no idea why. Without the transaction it was working fine..? So I'm thinking maybe the transaction is locking the table for too long and causing the query to fail?

 

I don't know. Looking for any advice help or pointers. I'm at the point of throwing my hands up and giving up. It doesn't make any sense.

Link to comment
Share on other sites

agree with Fenway and Muddy... post your code to get better help...

 

just guessing.... to  execute your Transaction are you using an Stored Procedure or Function?... something like:

<?php
   $query  = "CALL your_procedure()";
   mysql_query($query);
....
....
   $query2 = "SELECT a,b,s .... ";
   mysql_query($query2);   
//  The error could be triggered here depending on what you did
//  before this query with the results of the previous one

?>

 

if is something like this what are you doing then the error is caused because you are no processing all the results produced by the SP (at least 2).

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.