views:

3155

answers:

4

When ever I try to call store procedure in mysql that sends back a result set, it keeps saying me that "can't return a result set in the given context".

I've google it and some said it's mysql bug, some said you should change your mysqli driver and ....

Situation :

Using mysqli driver Client API library version 5.0.51a , PHP Version 5.2.4-2ubuntu5.6, Using Zend 1.9 RC 1 Mysqli adapter.

What should I do!?

A: 

Hi,

Not sure this is the solution to your problem, but what about trying with a more recent version of PHP ?
PHP 5.2.4 is definitly quite old -- so, if it's a bug in PHP's mysqli driver, it might have been corrected since...

Actually, after a quick search, it seems a problem like the one you are witnessing has been introduced between PHP 5.2.3 and PHP 5.2.4 (and was still here in PHP 5.2.5).
See bug #42548 : PROCEDURE xxx can't return a result set in the given context (works in 5.2.3!!)

Are you able to test with something like PHP 5.2.9 or 5.2.10 ?
I know these are not provided by Ubuntu, even in the last Ubuntu stable version :-( You might have to compile from sources :-(


Yet another idea would be to try mith PDO_MySql adapter : maybe it would work with that one ?
It might be possible to change Adapter without causing too much trouble / without taking hours to test ?


As you are working with Zend Framework 1.9, here's another post that might interest you, and might be easier to test : stored procedure error after upgrade to 1.8

An easy solution to try that would be to go back to Zend Framework 1.7 ; would it be possible for you, just to test ?


Anyway... Good luck !
And, if you find the solution, don't forget to indicate what the problem was, and how you solved it ;-)

Pascal MARTIN
Very Very good advices from you, thanks for your accuracy.
Farid
+2  A: 

The answer is to upgrade your php, I've just upgraded mine to 5.3.0, and it's works likes Candy!

Farid
Thanks for giving the solution you choose :-)(Just beware : using PHP 5.3 might lead to other troubles elsewhere in your code, as it bring lots of new stuff ^^ )
Pascal MARTIN
A: 

I had this problem recently on a contract. The client was using a codebase on windoze and php 5.2.6 and my installation was linux and php 5.3.1 Whatever we did, they wouldn't co-operate so in the end they gave me a windoze vista machine and we installed php 5.2.6 and off we went. Moral of the story: version matching counts. Weird cus I never had this ever before in any other job. But hey, you can't know everything. Very definitely not a MySql issue, just PHP.

ChippyAsh
A: 

It works perfectly with PHP 5.2.10 as well.

From an earlier version, I've successfully used mysqli::multi_query to call a problematic procedure and get the right results.

Shal