title: How to retrieve out parameter from mysqli stored procedure in php?
body: <p>I want to access OUT parameter, from my mysqli database using stored procedures, and save it in php variable for printing message on web page.</p>
  
  <p>My Stored Procedure Is:</p>
  
  <pre><code>DELIMITER $$
  CREATE procedure insertUser (IN _name varchar(50), IN _username varchar(50), IN _password varchar(50), IN _email varchar(50), IN _cellNumber int(11), IN _estateName varchar(50), OUT _rply varchar(50))
  
  
  BEGIN
  
  DECLARE count1 int;
  DECLARE count2 int;
  DECLARE varEstateId int;
  DECLARE _result varchar(50);
  
  select COUNT(*) into count1 from users where username = _username;
  select COUNT(*) into count2 from users where email = _email;
  
  if (count1+count2 &lt; 1)
  THEN
  insert into users (username , passkey , email) VALUES (_username ,_password,_email);
  insert into estatedetails (estateName, estateOwnerUsername) 
  values  (_estateName, _username);
  SELECT estateId into varEstateId from estatedetails where estateOwnerUsername = _username; 
  insert into usersdetail (username, name, cell1, estateId, accountType) 
  VALUES (_username, _name, _cellNumber, varEstateId, 'owner');
  set _result = 'inserted';
  else 
  set _result = 'alreadyExist';
  end IF;
  set _rply = _result;
  
  END$$
  DELIMITER;
  </code></pre>
  
  <p>My php side code for calling stored procedure is: (Incomplete Code)</p>
  
  <pre><code>$db = new mysqli('localhost', 'root', '', 'estatelink');
  $stmt=$db-&gt;prepare("CALL insertUser(?,?,?,?,?,?,?)");
  $stmt-&gt;bind_param('ssssiss',$name, $username, $password, $email, $num, $estate_name, $rply);
  $stmt-&gt;execute();
  $result= $rply;
  </code></pre>
  
  <p>Note: My query is executing perfectly inserting data with success. My only issue is that how can I access OUT parameter in this case it is $rply.</p>
  
  <p>Thanks in Advance.</p>