note 124017 added to mysqli.quickstart.stored-procedures
| From: | Valverde@php.net | Date: | Fri, 05 Jul 2019 20:16:00 +0000 |
| Subject: | note 124017 added to mysqli.quickstart.stored-procedures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-211481@lists.php.net to get a copy of this message | ||
<?php
// Store procedure call without params
$MyConnection = new mysqli ("DB_SERVER", "DB_USER", "DB_PASS",
"DB_NAME");
mysqli_multi_query ($MyConnection, "CALL MyStoreProcedure") OR DIE
(mysqli_error($MyConnection));
while (mysqli_more_results($MyConnection)) {
if ($result = mysqli_store_result($MyConnection)) {
while ($row = mysqli_fetch_assoc($result)) {
// i.e.: DBTableFieldName="userID"
echo "row = ".$row["DBTableFieldName"]."<br
/>";
....
}
mysqli_free_result($result);
}
mysqli_next_result($conn);
}
?>
*******************************************************************
<?php
// Store procedure call using params
$MyConnection = new mysqli ("DB_SERVER", "DB_USER", "DB_PASS",
"DB_NAME");
mysqli_query($MyConnection ,"SET @p0='".$MyParam1."'");
mysqli_query($MyConnection ,"SET @p1='".$MyParam2."'");
mysqli_multi_query ($MyConnection, "CALL MyStoreProcedure (@p0,@p1)") OR DIE
(mysqli_error($MyConnection));
while (mysqli_more_results($MyConnection)) {
if ($result = mysqli_store_result($MyConnection)) {
while ($row = mysqli_fetch_assoc($result)) {
// i.e.: DBTableFieldName="userID"
echo "row = ".$row["DBTableFieldName"]."<br
/>";
....
}
mysqli_free_result($result);
}
mysqli_next_result($conn);
}
?>
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.157.34 (proxied: 200.122.147.27)
----
Manual Page -- http://php.net/manual/en/mysqli.quickstart.stored-procedures.php
Edit -- https://master.php.net/note/edit/124017
Del: integrated -- https://master.php.net/note/delete/124017/integrated
Del: useless -- https://master.php.net/note/delete/124017/useless
Del: bad code -- https://master.php.net/note/delete/124017/bad+code
Del: spam -- https://master.php.net/note/delete/124017/spam
Del: non-english -- https://master.php.net/note/delete/124017/non-english
Del: in docs -- https://master.php.net/note/delete/124017/in+docs
Del: other reasons-- https://master.php.net/note/delete/124017
Reject -- https://master.php.net/note/reject/124017
Search -- https://master.php.net/manage/user-notes.php