Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$mysqli->query('DROP PROCEDURE IF EXISTS gh12107');
$sql = <<<SQL
CREATE PROCEDURE `gh12107`()
BEGIN
SELECT "hello world";
END;
SQL;
$mysqli->query($sql);
echo "Start or run 1\n";
$stmt = $mysqli->prepare("call `gh12107`()");
$stmt->execute();
$stmt->bind_result($output);
var_dump($stmt->fetch());
var_dump($output);
unset($output);
echo "End of run 1\n";
echo "Start or run 2\n";
$stmt->execute();
$stmt->bind_result($output);
var_dump($stmt->fetch());
var_dump($output);
echo "End of run 2\n";
?>