Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call to undefined method PDO::bindParam()

Tags:

php

Can someone tell me why I am getting this error? Call to undefined method PDO::bindParam()

Here is what I have, taken right off of PHPs site for stored procedures

$stmt = db::getInstance();
$stmt->prepare("CALL delete(?)");
$stmt->bindParam(2122, $return_value, PDO::PARAM_STR, 4000);
$stmt->execute();
print "procedure returned $return_value\n";
like image 405
Bebo Avatar asked Jan 13 '10 18:01

Bebo


1 Answers

The bindParam() method is inside the PDOStatement class, not the PDO class. The statement is the result of the prepare() method.

$foo = db::getInstance();
$stmt = $foo->prepare("CALL delete(?)");
$stmt->bindParam(2122, $return_value, PDO::PARAM_STR, 4000);
$stmt->execute();
print "procedure returned $return_value\n";
like image 73
Dereleased Avatar answered Sep 17 '22 15:09

Dereleased