mssql_bind problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am running PHP 4.3.2 and MS-SQL 2000.   I am trying to run some sample
code to make sure all works well.
The code below works fine.   It simply inserts a record into a table.  This
is done in the stored procedure code on the SQL server.

Code that works:
$myServer = "192.168.200.28";
$myUser = "sa";
$myPass = "xxxxxx";
$myDB = "Northwind";

$s = @mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");

$d = @mssql_select_db($myDB, $s)
or die("Couldn't open database $myDB");

$query = mssql_init("sp_addnewshipper", $s);
$result = mssql_execute($query);

However, when I try to pass a variable via the following code, I get an
error from my proxy server saying "Zero sized reply".  The problem seems to
be with the mssql_bind line.

Code that doesn't work:

$myServer = "192.168.200.28";
$myUser = "sa";
$myPass = "xxxxxx";
$myDB = "Northwind";

$s = @mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");

$d = @mssql_select_db($myDB, $s)
or die("Couldn't open database $myDB");

$query = mssql_init("sp_getprod", $s);
$supid = 2;
mssql_bind($query, "@supplierid", &$supid, SQLINT2,true);
$result = mssql_execute($query);
$numProds = mssql_num_rows($result);


echo "<h1>" . $numProds . " Product";

while($row = mssql_fetch_array($result))
{
echo "<li>".$row[0]."<li>";
}

?>



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux