×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Hi Dave,

Here's an SQL example that connect to the iseries and brings back a record
set from a physical file. About as basic as you can get I think.




$hostname = '192.168.0.50';
$username ='xxx';
$password = 'xxx';

// Username and password for the i5-user
$conn = i5_connect($hostname,$username,$password);
if ($conn)
{

/* Prepared request creation */

$key = 'Sassafrass';

$result = i5_prepare("SELECT FIELD1, FIELD2, FIELD3, FIELD4 FROM
ALIBRARY/AFILE WHERE FIELD3 = ?", $conn);

if ($result) {


/* Request execution */
i5_execute($result, $key);



echo "<TABLE border='1'>";
echo "<TR><TD>Field 1 Data</TD><TD>Field 2 Data</TD><TD>Field 3
Data</TD><TD>Field 4 data</TD></TR>";


while($row = i5_fetch_array($result,I5_READ_NEXT))

{


// print_r($row);

echo "<TR>";


echo "<TD>$row[FIELD1] </TD>";
echo "<TD>$row[FIELD2] </TD>";
echo "<TD>$row[FIELD3]</TD>";
echo "<TD>$row[FIELD4]</TD>";

echo "</TR>";



}

echo "</TABLE>";


/* Command closing */
i5_free_query($result);
}

else { echo "sql failed"; } }

else{ echo "connection failed" ;}








-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Dave Odom
Sent: Friday, February 13, 2009 2:50 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Anyone care to share some PHP code that uses SQL and SQL

Glenn, Mark & Michael,

I'm looking over what you sent me on this. Looking at all of it as fast as
I can absorb.

Thanks much,

Dave

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