title: PHP MySQL call Store Procedure with parameters
body: <p>In my php application i need to call a stored procedure from MySQL</p>
  
  <p>the procedure i have created is this.</p>
  
  <pre><code>DROP PROCEDURE IF EXISTS _proc.usp_hotel_rooms_mLoadByPrimaryKey;
  CREATE PROCEDURE _proc.`usp_hotel_rooms_mLoadByPrimaryKey`(
  _HTR_ID INT(11),
  _HTR_TYPE_ID INT(11)
   )
   BEGIN
  
  SELECT
      HTR_ID,
      HTR_NAME,
      HTR_TYPE_ID
  FROM hotel_rooms_m
  WHERE
      (HTR_ID = _HTR_ID AND HTR_TYPE_ID=_HTR_TYPE_ID)
    ;
  
   END;
  </code></pre>
  
  <p>I need to pass the parameters _HTR_ID and _HTR_TYPE_ID,so i tried it like this </p>
  
  <pre><code>&lt;?php 
  $con = mysql_connect("localhost","user","user")or die(mysql_error());
  $db =  mysql_select_db("_proc") or die(mysql_error());
  $par1 = "1";
  $par2 = "2";
  $dbh-&gt;query("CAST usp_hotel_rooms_mLoadByPrimaryKey($par1, $par2, @OutPut)");
   $dbh-&gt;query("SELECT @OutPut"); 
  echo $dbh;
  ?&gt;
  </code></pre>
  
  <p>this is the error i am getting <code>Call to a member function query() on a non-object in D:\xampp\htdocs\_proc\index.php on line</code></p>