I do have a connection established.
require_once('Connection.php');
try {
$conn = new Connection();
} catch (Exception $e) {
echo "Failure to connect";
echo $e->getMessage();
die();
}
But I was understanding the answer from
Glenn to mean that you pass the connection string in as a parm, like his
example below:
i5_prepare($db_connection,$qUpdateCustomer)
But your example has no such parm being passed in.????
-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of ADelgado@xxxxxxxxxxxxxxxxxx
Sent: Tuesday, April 13, 2010 10:11 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Calling a stored procedure from PHP, no it does
not work Alfredo
You don't have to specify the connection handler but I did take it
for
granted that a connection was established.
Try something like this for now:
$i5_connection = i5_connect( '127.0.0.1', $user, $password, array(
I5_OPTIONS_INITLIBL=>'NEWJCLIB' ) );
if( !$i5_connection ) var_dump( i5_error( ) );
$statuscode='XX';
$qUpdateCustomer = "CALL PROC_JC15_SEL( ? )";
$request = i5_prepare( $qUpdateCustomer );
if( !$request ) var_dump( i5_error( ) );
$paramSet = i5_setparam( $request, 0, $statuscode );
if( !$paramSet ) var_dump( i5_error( ) );
$procExec = i5_execute( $request );
if( !$procExec ) var_dump( i5_error( ) );
$stuff = i5_fetch_assoc( $request );
var_dump($stuff);
Add your own code (like better output) and comment out blocks as you
better understand how every proceeding function relies on the
previous
one.
--
Alfredo Delgado / Web Development
6800 Broken Sound Pkwy, Suite 150
Boca Raton, Florida 33487
-----web400-bounces@xxxxxxxxxxxx wrote: -----
To: Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>
From: Glenn Hopwood <ghopwood.list@xxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
Date: 04/13/2010 08:02
Subject: Re: [WEB400] Calling a stored procedure from PHP, no it
does
not work Alfredo
First, I don't think you can/should mix the i5* and db2* functions.
Second, your i5_prepare() function needs a db connection resource
passed
in as the first parameter /i5_prepare($db_connection,
$qUpdateCustomer)/. You should have gotten that returned from your
i5_connect() function. (I think it's i5_connect... I use the db2*
functions)
Glenn
On 4/13/2010 7:41 AM, Tom Deskevich wrote:
> Here is my code:
>
> $statuscode='XX';
> $qUpdateCustomer = "CALL NEWJCLIB/PROC_JC15_SEL( ? )";
> $request = i5_prepare( $qUpdateCustomer );
> i5_setparam( $request, 0, $statuscode );
> i5_execute( $request );
> $stuff=db2_fetch_array($request) ;
> var_dump($stuff);
>
> I got NULL NULL NULL on my var_dump
>
> PROC_JC15_SEL shows on the DSPOBJD as not being run (ever).
>
> Here is what the error log shows:
> db2_prepare() expects parameter 1 to be resource, object given in
> /www/zendcore/htdocs/xtld90083/jcs115.php on line 54
> db2_bind_param() expects parameter 1 to be resource, null given
in
> /www/zendcore/htdocs/xtld90083/jcs115.php on line 5
> db2_execute() expects parameter 1 to be resource, null given in
> /www/zendcore/htdocs/xtld90083/jcs115.php on line 57
> db2_fetch_array() expects parameter 1 to be resource, null given
in
> /www/zendcore/htdocs/xtld90083/jcs115.php on line
>
> -----Original Message-----
> From: web400-bounces@xxxxxxxxxxxx
[[1]mailto:web400-bounces@xxxxxxxxxxxx]
> On Behalf Of ADelgado@xxxxxxxxxxxxxxxxxx
> Sent: Monday, April 12, 2010 4:54 PM
> To: Web Enabling the AS400 / iSeries
> Subject: Re: [WEB400] Calling a stored procedure from PHP,they
can't
> make this stuff any easier.
>
> Does something like this not work for you?
>
> e.g.
>
> $qUpdateCustomer = "CALL SP_INSERT_F550101Z( ?, ?, ? )";
> $request = i5_prepare( $qUpdateCustomer );
> i5_setparam( $request, 0, $transactionId );
> i5_setparam( $request, 1, 'C' );
> i5_setparam( $request, 2, $_POST['ABALPH'] );
> i5_execute( $request );
>
> --
> Alfredo Delgado / Web Development
> 6800 Broken Sound Pkwy, Suite 150
> Boca Raton, Florida 33487
>
>
>
>
>
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [2]
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [3]
http://archive.midrange.com/web400.
References
Visible links
1. mailto:web400-bounces@xxxxxxxxxxxx
2.
http://lists.midrange.com/mailman/listinfo/web400
3.
http://archive.midrange.com/web400
As an Amazon Associate we earn from qualifying purchases.