Skip to content

Instantly share code, notes, and snippets.

@kenial
Created August 16, 2016 07:41
Show Gist options
  • Save kenial/aeca7c4fdbfca7c678b3c2b5b2b2d353 to your computer and use it in GitHub Desktop.
Save kenial/aeca7c4fdbfca7c678b3c2b5b2b2d353 to your computer and use it in GitHub Desktop.
PDO-based stored procedure call in PHP
<?php
// $db = new PDO($connection_string, $db_user, $db_password);
$plan_code = "PLAN_CODE";
$product_status = 200;
$page = 1;
$fetch = 20;
$qry = "CALL `db_billing`.`odp_cm_get_products`('$plan_code', $product_status, $page, $fetch, @total_row_count)";
$stm = $db->prepare($qry);
$stm->execute();
$rows = $stm->fetch();
$stm->closeCursor();
// fetch output params
$total_row_count = $db->query("select @total_row_count")->fetch(PDO::FETCH_ASSOC);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment