Here the code:
<?php
include_once 'config.php';
// Connect to database
$conn = oci_connect($dbuser, $dbpasswd, $dbhost."/".$dbname);
if (!$conn) {
exit ("Connection failed.");
}
$id = isset($_GET['id']) ? (int)$_GET['id'] : false;
$type = isset($_GET['type']) ? strtoupper($_GET['type']) : "BLOG";
$stmt = oci_parse($conn,
"begin
PKG_LIKE.get_LikeId(
:I_N_Id,
:I_S_Type,
:O_N_grade,
:O_N_exitFlag,
:O_S_exitMsg);
end;");
oci_bind_by_name($stmt, "I_N_Id", $id);
oci_bind_by_name($stmt, "I_S_Type", $type);
oci_bind_by_name($stmt, "O_N_grade", $total);
oci_bind_by_name($stmt, "O_N_exitFlag", $flag);
oci_bind_by_name($stmt, "O_S_exitMsg", $message);
if (!oci_execute($stmt)) {
exit("Procedure Failed.");
}
if ($message == 'OK') {
$response = array('likeit' => $total);
$toReturn = "var response=".json_encode($response)."; showTotalLikeit(response);";
} else {
$response = array('likeit' => 'NaN', 'exitFlag' => $flag, 'exitMsg' => $message);
$toReturn = "var response=".json_encode($response)."; showTotalLikeit(response);";
}
print $toReturn;
?>
Result is "Procedure Failed". Where i'm failing? I've just use stored procedure call (but with cursors as output) till now and all go fine :|
Launching the SP on Oracle works fine so it's a php problem :S