Created
September 22, 2016 14:41
-
-
Save phpdave/99f2d573cc4523c2641f3be678f280c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//Create db connection | |
$hostname = "MYIBMI"; | |
$user = "MYPROFILE"; | |
$password = ""; | |
$dbconn = new PDO("odbc:" . $hostname, $user, $password); | |
//SQL to run stored proc | |
$sql = "call #LALLAN.getCusInfo(?, ?, ?, ?)"; | |
//Prepare SQL for execution | |
$stmt = $dbconn->prepare($sql); | |
//Create a test object for demo purposes | |
$Customer = new stdClass(); | |
$Customer->ID = 1; | |
$Customer->Data1 = ""; | |
$Customer->Data2 = ""; | |
$Customer->Data3 = 1; | |
//Bind object properties to our object | |
$stmt->bindParam(1, $Customer->ID, PDO::PARAM_INT); | |
$stmt->bindParam(2, $Customer->Data1, PDO::PARAM_INPUT_OUTPUT); | |
$stmt->bindParam(3, $Customer->Data2, PDO::PARAM_INPUT_OUTPUT); | |
$stmt->bindParam(4, $Customer->Data3, PDO::PARAM_INPUT_OUTPUT); | |
//Run it | |
$stmt->execute(); | |
//Dump our object to the screen to see what everything got set to. Or alternatively run xdebug or another debugger to view the $Customer object after execution | |
var_dump($Customer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment