darksniperx Posted January 29, 2009 Share Posted January 29, 2009 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 ( ) Quote Link to comment https://forums.phpfreaks.com/topic/142978-mssql-query-analyser-returns-results-while-php-returns-rownum-1/ Share on other sites More sharing options...
darksniperx Posted January 29, 2009 Author Share Posted January 29, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142978-mssql-query-analyser-returns-results-while-php-returns-rownum-1/#findComment-749778 Share on other sites More sharing options...
corbin Posted January 29, 2009 Share Posted January 29, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142978-mssql-query-analyser-returns-results-while-php-returns-rownum-1/#findComment-750077 Share on other sites More sharing options...
darksniperx Posted January 30, 2009 Author Share Posted January 30, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/142978-mssql-query-analyser-returns-results-while-php-returns-rownum-1/#findComment-750639 Share on other sites More sharing options...
darksniperx Posted February 4, 2009 Author Share Posted February 4, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/142978-mssql-query-analyser-returns-results-while-php-returns-rownum-1/#findComment-754598 Share on other sites More sharing options...
corbin Posted February 4, 2009 Share Posted February 4, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/142978-mssql-query-analyser-returns-results-while-php-returns-rownum-1/#findComment-754763 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.