php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46609 can't read out the result from a mssql stored procedure
Submitted: 2008-11-19 09:17 UTC Modified: 2009-03-03 05:32 UTC
From: gyula dot fekete at different dot hu Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gyula dot fekete at different dot hu
New email:
PHP Version: OS:

 

 [2008-11-19 09:17 UTC] gyula dot fekete at different dot hu
Description:
------------
Hello,

I connect to a MSSQL server and run a stored procedure, but I can't read out the result of the query in that sp. I use the mssql_init,mssql_bind,mssql_execute functions like I saw on PHP.net, but it does not work. The stored procedure runs correctly, without any error, and it should return values, becouse I tested it in SQL Server Man. Studio whit the same parameters.



Reproduce code:
---------------
include("dbconn.php");

$from = 26;
$to = 28;

$dfrom = '20080101';
$dto = '20080331';

$stmt=mssql_init("FokonyvKartonLista", $conn);
mssql_bind($stmt, "@FszamTol", $from, SQLINT4);
mssql_bind($stmt, "@FszamIg", $to, SQLINT4);
mssql_bind($stmt, "@DatumTol", $dfrom, SQLCHAR);
mssql_bind($stmt, "@DatumIg", $dto, SQLCHAR);
$r=mssql_execute($stmt);


var_dump($r);
if (!$r){
    $message = "Last message from SQL : " . mssql_get_last_message() ."";
    echo $message;
}
while ($s = mssql_fetch_row($r)) {		
   echo "Row: ".$s[0]."<br />";
}

// OR
/*
do {
        while ($s = mssql_fetch_row($r)) {		 
		echo "Row: ".$s[0]."<br />";
	}
}
while(mssql_next_result($r));
*/


mssql_free_result($r);

mssql_close($conn);	

Expected result:
----------------
I expect the returnd rows of the query in the stored procedure.
The result of var_dump($r) is:
        resource(5) of type (mssql result)
What does this mean?

Actual result:
--------------
No result

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-03 05:32 UTC] kalle@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 09:01:29 2024 UTC