ZF2 – Stored procedure with out parameter


$stmt = $dbAdapter->createStatement(); 
$stmt->prepare('CALL my_procedure(?,?, @out)'); 
$stmt->getResource()->bindParam(1, 1, \PDO::PARAM_INT); 
$stmt->getResource()->bindParam(2, 'test'); 

// Retrieve output parameter 
$stmt2 = $dbAdapter->createStatement(); 
$stmt2->prepare("SELECT @out AS id"); 
$result = $stmt2->execute();         
$output = $result->current(); 

return (int) $output['id']

About the author

Janaki(http://mjanaki.com) - A Software developer with 9+ years of experience in multiple technology projects across web, mobile, and cloud applications with expertise in PHP, C#, MySQL, Web services and open source platforms.

Similar Posts

Leave a reply


Eye Test: * Time limit is exhausted. Please reload CAPTCHA.