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



Ahh...so here's what we can do with db2:

"SELECT * FROM MYLIB/MYFILE
OPTIMIZE FOR 50 ROWS
FETCH FIRST 50 ROWS ONLY"

Or however many rows we want.

Kelly



-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Kelly Cookson
Sent: Thursday, December 03, 2009 2:57 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] php vs net.data

Here's a simple db2_ example. Suppose you wanted to read a file called
MYLIB/MEMBERS. The file has three fields: FNAME, LNAME, and PHONE.

//Connect to the database
$conn = db2_connect("", "", "")
or die(db2_conn_errormsg());

//Prepare the SQL Query for execution
$query = "SELECT * FROM MYLIB.MEMBERS";
$statement = db2_prepare($conn, $query)
or die(db2_stmt_errormsg());

//Execute the query
db2_execute($statement)
or die(db2_stmt_errormsg());

//Retrieve the results
while ($row = db2_fetch_assoc($statement))
{
$first_name = $row["FNAME"];
$last_name = $row["LNAME"];
$phone_number = $row["PHONE"];

//process or display the data

}

//Close the connection
db2_close($conn);

Hope that helps a little.
Kelly



-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Larry Kleinman
Sent: Thursday, December 03, 2009 2:38 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] php vs net.data

OK, I'll check it out, thanks


Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100



"Kelly Cookson" <KCookson@xxxxxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
12/03/2009 03:28 PM
Please respond to
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>


To
"Web Enabling the AS400 / iSeries" <web400@xxxxxxxxxxxx>
cc

Subject
Re: [WEB400] php vs net.data






I don't know. But you don't need to use the i5_ database functions. You
can use the db2_ functions. Check out the db2_ database functions at:

http://www.php.net/manual/en/ref.ibm-db2.php

I'm assuming that pagination with LIMIT would work with the db2_
database functions. I haven't tried it, though.

I prefer using the db2_ functions because you get more functionality
than provided in the PHP Toolkit. I especially like using
db2_fetch_assoc because you get an associative array where the key is
the name of the field in the DB2 file. It makes code that processes
results much easier to read. I grew up on COBOL and like
self-documenting code.

I do use i5_ functions for other stuff. I don't want to imply something
is wrong with the PHP Toolkit.

Kelly

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Larry Kleinman
Sent: Thursday, December 03, 2009 2:05 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] php vs net.data

Pretty cool, Kelly. The only question is will it work with ZendCore
using
i5_query instead of mysql_query?


Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100



"Kelly Cookson" <KCookson@xxxxxxxxxxxx>
Sent by: web400-bounces@xxxxxxxxxxxx
12/03/2009 02:50 PM
Please respond to
Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>


To
"Web Enabling the AS400 / iSeries" <web400@xxxxxxxxxxxx>
cc

Subject
Re: [WEB400] php vs net.data






Here's a page that may be along the lines of what you seek:
http://www.phpsimplicity.com/tips.php?id=1

Kelly

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Larry Kleinman
Sent: Thursday, December 03, 2009 1:03 PM
To: Web Enabling the AS400 / iSeries
Subject: [WEB400] php vs net.data

Does anyone know if there is a PHP equivalent for the Net.Data report
variables called RPT_MAX_ROWS (which limits the number of report rows
returned by a SQL call) and START_ROW_NUM (which determines the starting

row of a SQL result set to show)

Larry Kleinman
Kleinman Associates, Inc.
212-949-6469
203-255-4100

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.