× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Tom,

We had a heck of a time finding an example as well. We managed to get
our PHP script calling a stored procedure to work just yesterday. Hope
this helps.

Dan...

PHP code Before This

function callpgm($prod)
{
// Make all global variables available here
foreach($GLOBALS as $arraykey=>$arrayvalue)
{
if($arraykey[0]!='_' && $arraykey != 'GLOBALS')
global $$arraykey;
}


$conn = db2_connect("system", "userid", "password");

if (!$conn)
{
die("Database connect failed($conn)");
}

$pkey='1';

//----------------- Prepare & Call the stored procedure
-----------------

$call='call SHASHI.GENKEY(?,?,?,?,?)';
$stmt = db2_prepare($conn,$call);
db2_bind_param($stmt, 1, "srlNo", DB2_PARAM_IN);
db2_bind_param($stmt, 2, "seats", DB2_PARAM_IN);
db2_bind_param($stmt,3, "expDate", DB2_PARAM_IN);
db2_bind_param($stmt,4, "prod", DB2_PARAM_IN);
db2_bind_param($stmt,5, "pkey", DB2_PARAM_OUT);

// call the stored procedure
$ret=db2_execute($stmt);

// Check if any errors occurred.
if (!$ret)
{
die("i5_program_call_failed ($ret)");
}

}

More PHP Code


I have done multiple searches and looked through 2 Redbooks
on PHP, and cannot find a simple example of calling a stored
procedure from PHP to build on.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.