I am running 4 queries (Stored Procedures actually) in a sequence.

The problem is after the 3rd query the 4th query is not running properly.

Queries are
1) Update the data in a table
2) Check the subscribers and email the change
3) Update breadcrumb (This stored procedure has cursor in it which goes through all the AFFECTED rows and update them)
4) Select the resulted data AFTER change

the 4th one doesn't work. I checked it and noticed that after running 1,2 and 4, the "conn" object has "1 in $conn->_queryID".

But after running 3rd, "$conn->_queryID" has Resource ID in it rather than 1.

If I force it to be 1, after running 4, it works fine. I don't see how that can be problem but I don't see any other change.

Can anybody see the problem?

Thanks