title: get value from stored procedure in php
body: <p>This is my SP:</p>
  
  <pre><code>DELIMITER $$
  
  CREATE DEFINER=FUNCTION `test`(p_begin varchar(10),p_end varchar(10),p_code varchar(2)) RETURNS varchar(10) CHARSET latin1
  BEGIN
      DECLARE V_ADA VARCHAR(8);
      DECLARE V_LAST VARCHAR(8);
      DECLARE V_NIK  VARCHAR(8);
  
      select NIK INTO V_NIK from absen where join_date &gt;= p_begin and join_date&lt;= p_end AND company_id=p_code ORDER BY NIK DESC LIMIT 1 ;
  
      SET V_NIK=V_NIK+1;
      return V_NIK;
  END
  </code></pre>
  
  <p>I am trying to get the return value with php:</p>
  
  <pre><code>$query=$this-&gt;db-&gt;query("select test(\"$begin\",\"$end\", \"$code\")")-&gt;result();
  
      var_dump($query);
      die;
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>array(1) { [0]=&gt; object(stdClass)#20 (1) { ["test("2007-01-01","2007-12-31", "1")"]=&gt; string(7) "118" } } 
  </code></pre>
  
  <p>My problem is that I want to get the value from stored procedure ("118") and I don't know how to change the object into a string.</p>