Jump to content

mssql query analyser returns results, while php returns [rownum] => -1 ?


Recommended Posts

Hello,

 

I run the query(stored procedure) in mssql query analyser , everything works and I get an output. When I run the same code in php and I do print_r, I get rownum => -1. Maybe I need to turn on some features in pear mdb2 so that I could see the results from running a stored procedure.

 

$qry = $mdb2->query("SET ANSI_NULLS ON; EXEC GetItems @item='1', @page=2");

 

print_r($qry);

[rownum] => -1
    [types] => Array
        (
        )

    [values] => Array
        (
        )

 

Hello,

 

I run the query(stored procedure) in mssql query analyser , everything works and I get an output. When I run the same code in php and I do print_r, I get rownum => -1. Maybe I need to turn on some features in pear mdb2 so that I could see the results from running a stored procedure.

 

$qry = $mdb2->query("SET ANSI_NULLS ON; EXEC GetItems @item='1', @page=2");

 

print_r($qry);

[rownum] => -1
    [types] => Array
        (
        )

    [values] => Array
        (
        )

 

Update:

 

If i run a regular select * from table, I get results in php no problem.

It might not like that it is two queries.  (That could potentially return 2 row resources, and I bet MDB2 wasn't designed for that.

 

I would suggest just breaking it into 2 query() calls.

 

I think I have already tried that. But I will try again.

 

Thank you!

It might not like that it is two queries.  (That could potentially return 2 row resources, and I bet MDB2 wasn't designed for that.

 

I would suggest just breaking it into 2 query() calls.

 

I think I have already tried that. But I will try again.

 

Thank you!

 

I have tryed to run it into 2 query calls, but I dont think I was doing it correctly, would you be able to show me an example.

 

Than you!

Hrmm, I haven't used MDB2 before, but

 

 

$mdb2->query("SET ANSI_NULLS ON;");

$qry = $mdb2->query("EXEC GetItems @item='1', @page=2;");

 

 

Should do it.

 

 

Edit:  You could always alter your procedure to not rely on ANSI nulls by the way.

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.