I found that mysql supports stored procedures and start working on them. Bad idea!
On php site (http://php.net/manual/en/pdo.prepared-statements.php) you get this piece of code:
Example #4 Calling a stored procedure with an output parameter
<?php
$stmt = $dbh->prepare("CALL sp_returns_string(?)");
$stmt->bindParam(1, $return_value, PDO::PARAM_STR, 4000);
$stmt->execute();
print "procedure returned $return_value\n";
?>
After spending a couple of hours on trial-error coding different solutions I compiled this workaround:
<?php
$stmt = $dbh->prepare("CALL sp_returns_string(@out_param)");
$stmt->execute();
$result = dbh->query("SELECT @out_param")->fetch();
print "procedure returned ". $result['@out_param'] ."\n";
?>
To conclude: do not use mysql and php on any serious apps.
G.