DB server: MSSQL 2000
System: RedHat Linux 8.0
Driver FreeTDS: 0.61
PHP_rev: 4.3.2 (also tried on 4.3.1 gives same problem)
Apache 2.0.46

I'm having a problem with mssql_bind under this configuration it appears not
to be binding variables specified to the stored procedure and I was
If anyone has come across this before.

I have noted from a post in the user manual from the 27th April '03
(http://uk.php.net/manual/en/function.mssql-execute.php) that there
was a bug in 4.3.2-RC1 for the mssql_bind statement I was wondering
If this could also be causing a problem with the binding to stored

I've looked on the bug list and I don't see anything referencing this

The code we are using is:

$StaffSN = "crl26";

// ****** Init return value ******* //
$ret = 1;

// ****** Set database vars ******* //
$myServer = "sqlserver";
$myUser = "blah";
$myPass = "xxxxxx";
$myDB = "InTime";
// ****** Link to database ******* //
$serverLink = mssql_connect($myServer, $myUser, $myPass) or die("Could not
connect to SQL Server on $myServer");

$db = mssql_select_db($myDB, $serverLink) or die("Couldn't open database

// ****** Query for user details ******* //
$query = mssql_init("sp_StaffDetail", $serverLink);
mssql_bind($query, "@ShortName", $StaffSN, SQLVARCHAR);
mssql_bind($query, "RETVAL", $ret, SQLINT4);
$result = mssql_execute($query);

The execute gives the error:
Warning: mssql_execute(): message: Procedure 'sp_StaffDetail' expects
parameter '@ShortName', which was not supplied. (severity 16) in
/home/shares/staffweb/index2.php on line 46

Warning: mssql_execute(): stored procedure execution failed in
/home/shares/staffweb/index2.php on line 4

I have turned on Debug output on FreeTDS and it seems to show the stored
procedure being called
without any bound variables (as indicated by the error from PHP)

I'm not quite sure if it is PHP not binding the variables or FreeTDS
ignoring them, but by the post in the PHP
manual (http://uk.php.net/manual/en/function.mssql-execute.php) this was
working previously with
FreeTDS 0.61 so I can only assume it's either PHP, a coding error by the
developer, or a set-up problem with FreeTDS.

Does anyone have any ideas?

Many thanks

Andrew Masterton

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to