#40901 [Opn]: mssql_execute errror

From: Date: Fri, 23 Mar 2007 11:20:07 +0000
Subject: #40901 [Opn]: mssql_execute errror
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110732@lists.php.net to get a copy of this message
 ID:               40901
 User updated by:  lh at moranti dot com
 Reported By:      lh at moranti dot com
 Status:           Open
 Bug Type:         MSSQL related
 Operating System: ubuntu
 PHP Version:      5.2.1
 New Comment:

Sorry the code schould look like this

<?
	$conn = mssql_connect("host","user","pass");
	mssql_select_db("dbscheme", $conn);
	$int=10;
	$sp = mssql_init("test", $conn); // stored proc name
	mssql_bind($sp, "@sval ",$int,SQLINT4);
	$query  = mssql_execute($sp) or die("oops");
?>


Previous Comments:
------------------------------------------------------------------------

[2007-03-23 11:15:14] lh at moranti dot com

The storedprocedure looks like this:

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
CREATE PROCEDURE [dbo].[test]
(
   @sval int
) AS
return @sval+10


And the php code looks like this

<?
	$conn = mssql_connect("host","user","pass");
	mssql_select_db("dbscheme", $conn);
	
	$sp = mssql_init("test", $conn); // stored proc name
	$query  = mssql_execute($sp) or die("oops");

?>

is fails in this line "$query  = mssql_execute($sp) or die("oops");"

------------------------------------------------------------------------

[2007-03-23 10:56:53] tony2001@php.net

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[2007-03-23 10:29:27] lh at moranti dot com

Description:
------------
I have a problem executing a stored procedure. 
It fails on my ubuntu installation with php 5.2.1 but when i run it
with php 5.1.6 no problem.

Reproduce code:
---------------
mssql_select_db("dbname", $conn);
$sp = mssql_init("procedurename", $conn); // stored proc name
	$compId=1000;
	$SessionId = substr(session_id(),0,8);
	
	mssql_bind($sp, "@CompID",$compId,SQLVARCHAR);
	mssql_bind($sp, "@SessionID",$SessionId,SQLVARCHAR);
	mssql_bind($sp, "@BasketAmount",$BasketAmount,SQLVARCHAR,TRUE);
	mssql_bind($sp, "@BasketTotalItem",$BasketTotalItem,SQLVARCHAR,TRUE);
	$query  = mssql_execute($sp) or die("could not perform insert");

Actual result:
--------------
Warning: mssql_execute() [function.mssql-execute]: stored procedure
execution failed in /home/www/sitename/test_init.php on line 14


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40901&edit=1


Thread (10 messages)

« previous php.bugs (#110732) next »