You don't have to specify a particular connection handler unless there's a
particular connection that you want to use instead of the last one that
was established.
In an attempt to remove ambiguity I provided a follow-up example,
incorporating your code, with the connection included -- an i5 connection.
I also updated your code to use an i5 toolkit array fetch function instead
of a db2 function.
Alfred
--
Alfredo Delgado / Web Development
6800 Broken Sound Pkwy, Suite 150
Boca Raton, Florida 33487
(561) 443-9152 - Desk
(561) 350-4143 - Cell
(561) 443-9108 - Fax
-----web400-bounces@xxxxxxxxxxxx wrote: -----
To: "'Web Enabling the AS400 / iSeries'" <web400@xxxxxxxxxxxx>
From: "Tom Deskevich" <thomas.l.deskevich@xxxxxxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
Date: 04/13/2010 11:04
Subject: Re: [WEB400] Calling a stored procedure from PHP, Alfredo
i5_prepare parms ??
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
[[1]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][2]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][3]
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [3][4]
http://archive.midrange.com/web400.
References
Visible links
1. [5]mailto:web400-bounces@xxxxxxxxxxxx
2. [6]
http://lists.midrange.com/mailman/listinfo/web400
3. [7]
http://archive.midrange.com/web400
--
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: [8]
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [9]
http://archive.midrange.com/web400.
--
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: [10]
http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [11]
http://archive.midrange.com/web400.
References
Visible links
1. mailto:web400-bounces@xxxxxxxxxxxx
2. mailto:web400-bounces@xxxxxxxxxxxx
3.
http://lists.midrange.com/mailman/listinfo/web400
4.
http://archive.midrange.com/web400
5. mailto:web400-bounces@xxxxxxxxxxxx
6.
http://lists.midrange.com/mailman/listinfo/web400
7.
http://archive.midrange.com/web400
8.
http://lists.midrange.com/mailman/listinfo/web400
9.
http://archive.midrange.com/web400
10.
http://lists.midrange.com/mailman/listinfo/web400
11.
http://archive.midrange.com/web400
As an Amazon Associate we earn from qualifying purchases.