Heim > Artikel > Backend-Entwicklung > php 调用mssql 存储过程不能执行问题
存储过程不能执行还是什么情况,反正不能出现结果
require("../inc/hbmconn.php");//传入vip 姓名$name=iconv("utf-8","gb2312",$_REQUEST['name']);$startTime="2012-04-01";$endTime="2012-04-03";$procedure = mssql_init("procGetVIPConsumeDetail",$conn);mssql_bind($procedure,"@vipConsumerFilter",$name, SQLVARCHAR); mssql_bind($procedure,"@startDate",$startTime, SQLDATETIME); mssql_bind($procedure,"@endDate",$endTime, SQLDATETIME); $resource = mssql_execute($procedure);mssql_free_statement($procedure);
echo mssql_get_last_message();
看看有无错误信息
echo mssql_get_last_message();
看看有无错误信息
常量 SQLDATETIME 没有定义
请确认你书写的是否正确
你还可以 print_r(get_defined_constants());
看一下是否有类似的常量
最后那条错误信息的含义不太清楚,可能是日期格式不对吧
//传入vip 姓名$name=iconv("utf-8","gb2312",$_REQUEST['name']);//echo $name;$startTime="1970-01-01";$endTime=date("H-m-d");$procedure = mssql_init("procGetVIPConsumeDetail",$conn);mssql_bind($procedure,"@vipConsumerFilter",$name, SQLVARCHAR); mssql_bind($procedure,"@startDate",$startTime, SQLVARCHAR); mssql_bind($procedure,"@endDate",$endTime, SQLVARCHAR); $resource = mssql_execute($procedure);mssql_free_statement($procedure);