0

我有一个存储过程调用 updateLosingSelections

当我跑

 call updateLosingSelections 

直接在我的 mysql 数据库上出现预期的结果。

当我尝试使用 pdo 从 php 页面运行它时,没有任何反应,但同样没有抛出或显示错误。我在这里遗漏了一些明显的东西吗?这是我的php页面代码。

 <?php
session_start();
include_once('../connections/connection.php');
$sql_update_standings = 'call updateLosingSelections()';
$sth = $dbh->prepare($sql_update_standings);
$sth->execute();
 ?>

多谢你们。DS

编辑...最后,我将存储过程中的 sql 放入了存储过程中,并将其保留为 pdo 语句中的 sql 代码。把头发扯下来对我不好。

4

1 回答 1

0

我的第一个明显问题是,当您的 updateLosingSelections() 没有参数时,为什么要将 $data 数组传递给 execute()?

本质上:

//turn this
$sth->execute($data);

//into this
$sth->execute();


//or if you want to do this
$sth->execute($data);

//then make sure to do this
session_start();
include_once('../connections/connection.php');
$sql_update_standings = 'call updateLosingSelections(?,?)'; //two question marks as placement holders
$sth = $dbh->prepare($sql_update_standings);
$sth->execute($data('somedata','moredata')); //two pieces of data which will replace the two ? marks above

我建议看一下 DB2 文档,看起来很相似。 http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.swg.im.dbclient.php.doc%2Fdoc%2Ft0023502.html

于 2013-07-26T14:19:41.603 回答