Jump to content

php and stored procedure (mulit row return)


Recommended Posts

Hi I have used the code below and so far works as it should.  However i would further like to place the results into a simple table and was wondering whats the best way of doing this?

Tahanks

 

output example

Column 1 Column2 Column 3    ......

values    values    value      .......

 

 

 


$curs = OCINewCursor($conn);
$stmt = OCIParse($conn,"begin p_all_houses(_ten_type, _recordset); end;");

OCIBindByName($stmt,"_ten_type",&$tenant,32);
OCIBindByName($stmt,"_recordset",&$curs,10,OCI_B_CURSOR);

ociexecute($stmt);
ociexecute($curs);

while (OCIFetchInto($curs,&$p_recordset)) {
   echo "<pre>";
    print_r($p_recordset );
   echo "</pre>";
}

Produces this

Array
(
    [0] => 6
    [1] => 2
    [2] => 4 Sevensea Avenue
    [4] => Sheffield
    [5] => S4 5JS
    [6] => family
    [7] => detached
    [8] => 0
)

.................

  • 4 weeks later...

I guess by Table you mean HTML Table?

 

Use something like this

 

<table>

<?

for ($i=0;$i<count($p_recordset);$i++)

{?>

<tr>

<td><?=$p_recordset?></td>

</tr>

<table>

<?}?>

 

 

while (OCIFetchInto($curs,&$p_recordset)) {

  echo "<pre>";

    print_r($p_recordset );

  echo "</pre>";

}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.