I think this should work...but of course it doesn't. :)

Stored Procedure
=============
DROP PROCEDURE NEWSYS/GETCUSNAME;

CREATE PROCEDURE NEWSYS/GETCUSNAME()
RESULT SETS 1
LANGUAGE RPGLE
EXTERNAL NAME GETCUSNAME
READS SQL DATA
PARAMETER STYLE GENERAL;

SQLRPGLE
=========
DCusNames DS Occurs(7)
D Parm1 10

D I S 10I 0

/Free

For I = 1 To 7;
%Occur(CusNames) = I;
Parm1 = 'Hey';
EndFor;

Exec SQL
Set Result Sets Array :CusNames for 7 rows;

*InLR = *On;

PHP
===
<?php

/* Include System i connection information */
//if ((include "i5_properties.php") == false) {
// echo("Problem encountered loading i5_properties.php include file");
//}

$conn = i5_connect("192.168.99.99", "myuser", "mypass");
if (!$conn) {
echo 'Error conecting to database: ' . i5_errormsg();
}
$sql="CALL GETCUSNAME";
$stmt=i5_prepare($sql);
if (!$stmt) {
echo 'Prepare error: ' . i5_errno() . '<br/>Msg: ' . i5_errormsg() . '<br/>';
die();
}
//$ret = i5_bind_param( $stmt, &$CusName );

$result = i5_execute($stmt);
if (!$result) {
echo 'Execute error: ' . i5_errno() . '<br/>Msg: ' . i5_errormsg() . '<br/>';
die();
}

echo '<br><table border=1 cellpadding=5 cellspacing=5>';

/* Iterate through result set, printing one table line per record returned. */
while ($row = i5_fetch_array($stmt)) {
if (!$row=='') {
echo "<tr><td>$row[0]<td>$row[1]<td>$row[2]<td>$row[3]</td><td>$row[4]<td>$row[5]<td>$row[6]<td>$row[7]</td></tr>";
}
}

// Close table
echo '</table><br>';

i5_close($conn);
?>

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.