note 109791 modified in pdostatement.bindparam by danbrown

From: Date: Fri, 31 Aug 2012 15:48:37 +0000
Subject: note 109791 modified in pdostatement.bindparam by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-190336@lists.php.net to get a copy of this message
Spent all day banging my head against a brick wall.

Tried to use INOUT or OUT and getting the return variable into PHP using Mysql v5.5.16 on XAMPP.

"MySQL doesn't supporting binding output parameters via its C API. You must use SQL level variables:"

<?php
$stm = $db->prepare("CALL sp_mysp(:Name, :Email, @sp_result)");

$outputArray = $db->query("select @sp_result")->fetch(PDO::FETCH_ASSOC);
?>

So the 'workaround' for Mysql and PDO is to use two SQL calls.

Hope this helps someone. --was-- Spent all day banging my head against a brick wall. Tried to use INOUT or OUT and getting the return variable into PHP using Mysql v5.5.16 on XAMPP. "MySQL doesn't supporting binding output parameters via its C API. You must use SQL level variables:" $stm = $db->prepare("CALL sp_mysp(:Name, :Email, @sp_result)"); $outputArray = $db->query("select @sp_result")->fetch(PDO::FETCH_ASSOC); So the 'workaround' for Mysql and PDO is to use two SQL calls. Hope this helps someone. http://php.net/manual/en/pdostatement.bindparam.php

« previous php.notes (#190336) next »