Jump to content

how to get out put parameter's value in php.


naeembhatti

Recommended Posts

hi friends h r u?
i use simple stored procedure e.g
in mysql=============================
CREATE PROCEDURE `test`.`users` (OUT returnval int)
BEGIN
set returnval = 100;
END //
how to get its value in php===================i am currently using this

$mysqli = new mysqli("localhost", "root", "bhatti", "test");

if (mysqli_connect_errno())
{
  printf("Connection failed: %s\n", mysqli_connect_error());
  exit();
}

$SQL = "CALL users(@retval)";
if (!$mysqli->real_query($SQL))
{
  printf("Invalid query: %s\nWhole query: %s\n", $mysqli->error, $SQL);
  exit();
}

if ($result = $mysqli->store_result())
{
  while ($myrow = $result->fetch_array(MYSQLI_ASSOC))
  {
      print_r($myrow);
  }
  $result->close();
}

$mysqli->close();

=======================================

but when i wrote in phpmyadmin like CALL users(@retval); SELECT @retval; it returns me value but how to get it in php?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.