Jump to content

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


darksniperx

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
        (
        )

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.