In my php application i need to call a stored procedure from MySQL
the procedure i have created is this.
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;
I need to pass the parameters _HTR_ID and _HTR_TYPE_ID,so i tried it like this
<?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->query("CAST usp_hotel_rooms_mLoadByPrimaryKey($par1, $par2, @OutPut)");
$dbh->query("SELECT @OutPut");
echo $dbh;
?>
this is the error i am getting Call to a member function query() on a non-object in D:\xampp\htdocs\_proc\index.php on line