PDOStatement :: execute()最多需要1个参数,给定2个

时间:2015-04-02 14:41:25

标签: php mysql stored-procedures drupal pdo

运行此代码时不断收到错误消息。存储过程有两个值,begindate和endate。它是从表单处理的,在提交时,值将存储在startdatevalue和enddatevalue中。

错误如标题所述。

  

PDOStatement :: execute()最多需要1个参数,2个给定

唯一可能感兴趣的其他信息是这是drupal中的自定义模块。

$startdatevalue = "03/25/2015";
$enddatevalue = "04/02/2015";

print_r($startdatevalue." and ".$enddatevalue);



$conn = Database::getConnection(); //get connection

$saved_class = $conn->getAttribute(PDO::ATTR_STATEMENT_CLASS);

$conn->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement'));

$statement_siteUsage = $conn->prepare("Call sps_SiteUsageStatistics(?,?)"); //stored procedure to be run


$op_status = $statement->bindParam(1, $startdatevalue, PDO::PARAM_STR);//| PDO::PARAM_INPUT_OUTPUT
$op_status = $statement->bindParam(2, $enddatevalue, PDO::PARAM_STR);// | PDO::PARAM_INPUT_OUTPUT

$exec_result = $statement_siteUsage->execute();
$conn->setAttribute(PDO::ATTR_STATEMENT_CLASS, $saved_class);

//$startdatevalue = $_POST["begindate"];
//$enddatevalue = $_POST["enddate"];

$sql_siteUsage = $exec_result;

$result = db_query($sql_siteUsage);
$record = fetchAll();

0 个答案:

没有答案