$id = mssql_connect($hostname,$dbuser,$dbpasswd) or dIE("無法連接數據庫服務器!");
//printf("%d
\n", $id);
$db = mssql_select_db("stock",$id) or dIE("無法連接stock數據庫!");
$stockcode='600600';
$id = 0;
$msg = 0;
//printf("%d
\n", $db);
//$query = "exec sp_test @code='600028',@id=0,@msg='000000'";
$query = "declare @result int, @id int, @msg varchar(20)\n";
$query.="exec @result=sp_test\n";
$query.="\"$stockcode\",\n";
$query.="@id output,\n";
$query.="@msg output;\n";
$query.="select @result result, @id id, @msg msg";
/*$query = "declare @result int, @id int, @msg varchar(20)\n";
$query.="exec @result=sp_test\n";
$query.="\"$stockcode\",\n";
$query.="@id output,\n";
$query.="@msg output;\n";
$query.="select @result result, @id id, @msg msg";
*///$query = "update test set stockname='2test' where stockcode='600028'";
//$query = "insert into test(stockcode,stockname,id) values ('600028','test',13)";
//$query = "select * from test where stockcode='600028'";
//$query = "select 0 where 1=0 ";
$rresult = mssql_query($query) or dIE("無法執行SQL:$query");
$arr = mssql_fetch_array($rresult);
print $result;
print "
\n";
printf("%d, %d, %s
\n", $arr[result], $arr[id], $arr[msg]);
printf("%d, %s
\n", $id,