文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>php调用ms sql存储过程

php调用ms sql存储过程

时间:2007-02-17  来源:PHP爱好者

<?php
$hostname = "tszzp";
$dbuser = "sa";
$dbpasswd = "";

$id = mssql_connect($hostname,$dbuser,$dbpasswd) or die("无法连接数据库服务器!");
//printf("%d<BR>n", $id);
$db = mssql_select_db("stock",$id) or die("无法连接stock数据库!");
$stockcode='600600';
$id = 0;
$msg = 0;
//printf("%d<BR>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_testn";
$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_testn";
$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 "<br>n";
printf("%d, %d, %s<br>n", $arr[result], $arr[id], $arr[msg]);
printf("%d, %s<br>n", $id, $msg);
//$stock = mssql_fetch_array($result);
//$name = $stock[id];
//print $name;
//print "abc";

?>


php爱 好者站 http://www.phpfans.net 文章|教程|下载|源码|论坛.
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载