Monday, 15 February 2010

php - PDO bindParam() fatal error -



php - PDO bindParam() fatal error -

i'm trying larn pdo, have written little piece of code, gives me fatal error:

fatal error: phone call fellow member function bindparam() on non-object in...

$con = new mysqli("127.0.0.1","root","","csvdangercheck"); $query = $con->prepare("insert `testtabel` (`id`, `var1`, `var2`) values (:id , :var1, :var2);"); $query->bindparam(':id', $id); $query->bindparam(':var1',$val1); $query->bindparam(':var2',$val2); $query->execute();

i tried using print_r($con->errorinfo()); returned following:

fatal error: phone call undefined method mysqli::errorinfo() in...

can tell me i'm missing here?

like fluffeh said, mixing pdo , mysqli, seek this:

$con = new pdo('mysql:host=127.0.0.1;dbname=csvdangercheck', 'root', '');

php mysql pdo

No comments:

Post a Comment