程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> 關於MYSQL數據庫 >> php調用ms sql存儲過程

php調用ms sql存儲過程

編輯:關於MYSQL數據庫
$hostname = "tszzp";
$dbuser = "sa";
$dbpasswd = "";

$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,

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved