× 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.



Hey Tom,

You can use i5_paramdesc to describe the parameters and hence specify
which are IN, OUT, or INOUT. Being able to use INOUT in a stored procedure
on PHP on an IBM i was new to me until I rewrote an old ODBC request to
use the i5 toolkit about 10 minutes ago.

$statuscode='XX';
$qUpdateCustomer = "CALL NEWJCLIB/PROC_JC15_SL( ? )";

$request = i5_prepare( $qUpdateCustomer );
if( !$request ) var_dump( i5_error( ) );
$paramDesc = i5_paramdesc( $request, I5_TYPE_CHAR, 0, 5, 0,
I5_INOUT ); // I guessed at 5 for the length
if( !$paramDesc ) 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) ;

Alfred
--
Alfredo Delgado
6800 Broken Sound Pkwy, Suite 150
Boca Raton, Florida 33487

-----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 14:41
Subject: Re: [WEB400] Calling a stored procedure from PHP, Alfredo -
closer (I think)

Ok, I have made a huge stride. It is now actually calling the stored
procedure. I can see that via DSPOBJD.

If I call the stored procedure via iseries navigator, it does give me a
result set back.

Here is what I get with a vardump:
array(1) { [""]=> string(2) "XX" }

Is that what I should expect? It seems to just be giving me my parm
back.

$statuscode='XX';
$qUpdateCustomer = "CALL NEWJCLIB/PROC_JC15_SL( ? )";

$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) ;

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx
[[1]mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of ADelgado@xxxxxxxxxxxxxxxxxx
Sent: Tuesday, April 13, 2010 12:07 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Calling a stored procedure from PHP, Alfredo
i5_prepare parms ??

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][2]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][3]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][4]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][5]http://archive.midrange.com/web400.

References

Visible links
1. [5][6]mailto:web400-bounces@xxxxxxxxxxxx
2. [6][7]http://lists.midrange.com/mailman/listinfo/web400
3. [7][8]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][9]http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [9][10]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][11]http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [11][12]http://archive.midrange.com/web400.

References

Visible links
1. [13]mailto:web400-bounces@xxxxxxxxxxxx
2. [14]mailto:web400-bounces@xxxxxxxxxxxx
3. [15]http://lists.midrange.com/mailman/listinfo/web400
4. [16]http://archive.midrange.com/web400
5. [17]mailto:web400-bounces@xxxxxxxxxxxx
6. [18]http://lists.midrange.com/mailman/listinfo/web400
7. [19]http://archive.midrange.com/web400
8. [20]http://lists.midrange.com/mailman/listinfo/web400
9. [21]http://archive.midrange.com/web400
10. [22]http://lists.midrange.com/mailman/listinfo/web400
11. [23]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: [24]http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [25]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: [26]http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [27]http://archive.midrange.com/web400.

References

Visible links
1. mailto:web400-bounces@xxxxxxxxxxxx
2. mailto:web400-bounces@xxxxxxxxxxxx
3. mailto:web400-bounces@xxxxxxxxxxxx
4. http://lists.midrange.com/mailman/listinfo/web400
5. http://archive.midrange.com/web400
6. mailto:web400-bounces@xxxxxxxxxxxx
7. http://lists.midrange.com/mailman/listinfo/web400
8. http://archive.midrange.com/web400
9. http://lists.midrange.com/mailman/listinfo/web400
10. http://archive.midrange.com/web400
11. http://lists.midrange.com/mailman/listinfo/web400
12. http://archive.midrange.com/web400
13. mailto:web400-bounces@xxxxxxxxxxxx
14. mailto:web400-bounces@xxxxxxxxxxxx
15. http://lists.midrange.com/mailman/listinfo/web400
16. http://archive.midrange.com/web400
17. mailto:web400-bounces@xxxxxxxxxxxx
18. http://lists.midrange.com/mailman/listinfo/web400
19. http://archive.midrange.com/web400
20. http://lists.midrange.com/mailman/listinfo/web400
21. http://archive.midrange.com/web400
22. http://lists.midrange.com/mailman/listinfo/web400
23. http://archive.midrange.com/web400
24. http://lists.midrange.com/mailman/listinfo/web400
25. http://archive.midrange.com/web400
26. http://lists.midrange.com/mailman/listinfo/web400
27. http://archive.midrange.com/web400

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.