$a = 1;
$b = 2;
try {
$dbh = new PDO($dsn, $user, $password);
print "Before: a = $a, b = $b\n";
$stm = $dbh->prepare('call my_out (?)');
$stm->bindParam(1, $a, PDO::PARAM_INT);
if ($stm->execute()) {
print "After: a = $a\n";
} else {
print_r($stm->errorInfo());
}
$stm = $dbh->prepare('call my_inout (?)');
$stm->bindParam(1, $b, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT);
if ($stm->execute()) {
print "After: b = $b\n";
} else {
print_r($stm->errorInfo());
}
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}