Monday, July 9, 2007

PHP Pear to execute MYSQL Stored Procedure

Tried to google but seems like there is no other option than using a multiquery to execute multiple Stored procedures

http://pear.php.net/bugs/bug.php?id=6418


Test script:
---------------
Sample script, when no results are needed:

for($i=0; $i<3; $i++)
{
//asuming we have a valid mysqli object
if (!$mysqli->multi_query("call someStoredProc(1)"))
{
printf("Error: %s\n", $mysqli->error);
}
else
{
do
{
if ($result = $mysqli->store_result())
{
$result->close();
}
} while ($mysqli->next_result());
}
}

No comments: