Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在PDO中转换mysqli_stmt_bind_结果_Php_Pdo_Mysqli - Fatal编程技术网

Php 如何在PDO中转换mysqli_stmt_bind_结果

Php 如何在PDO中转换mysqli_stmt_bind_结果,php,pdo,mysqli,Php,Pdo,Mysqli,我想知道PDO中的mysqli\u stmt\u bind\u result()的语法是什么 我需要转换: mysqli\u stmt\u bind\u结果($stmt,$row->费用) 在PDO中,函数为。它的使用方式非常相似: $stmt->bindColumn('column', $row->Expenses); 其中,column是数据库中列的名称。假设我有一个查询$stmt=$this->vConnection->prepare(“从$this->tablename中选

我想知道PDO中的
mysqli\u stmt\u bind\u result()的语法是什么

我需要转换:
mysqli\u stmt\u bind\u结果($stmt,$row->费用)
在PDO中,函数为。它的使用方式非常相似:

$stmt->bindColumn('column', $row->Expenses);

其中,
column
是数据库中列的名称。

假设我有一个查询$stmt=$this->vConnection->prepare(“从$this->tablename中选择汇率,其中curr=?”$stmt->bindparam(1,$curr)$stmt->execute()$stmt->bindColumn(1,$row->rate);这是正确的方法吗???@user2893428我想是的。但是PDO允许您对命名的参数进行修改,这要好多了<代码>$stmt=$this->vConnection->prepare(“从$this->tablename中选择汇率,其中curr=:currency”)$stmt->bindparam(':currency',$curr)$stmt->execute()$stmt->bindColumn('rate',$row->rate)非常感谢lonesomeday。我们可以在同一个应用程序中同时使用命名参数和问号参数吗???,事实上我在很多地方都使用过问号,所以我现在可以在其他地方使用命名参数吗?@user2893428在同一个应用程序中,是的。在同一个查询中?你可以,但我强烈反对!正如您所回答的,我使用了命名参数。$stmt=$this->vConnection->prepare(“从$this->tablename中选择汇率,其中curr=:currency”)$stmt->bindparam(':currency',$curr)$stmt->execute()$stmt->bindColumn('rate',$row->rate);仍然收到相同的错误HipHop警告:从第211行的/var/www/webApp/services/CurrencyService.php中的空值创建默认对象,位于$stmt->bindColumn('rate',$row->rate)行;