note 43275 deleted from function.ora-columnname by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 16 Jun 2004 17:43:54 +0000 |
| Subject: | note 43275 deleted from function.ora-columnname by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-71156@lists.php.net to get a copy of this message | ||
Note Submitter: paha@paha.hu
----
with this it's easy to write a function similar to mysql_fetch_array:
function select($conn, $sqlcomm)
{
$result = array();
$cur = ora_open($conn) or die ("Open cursor failed: ".ora_error());
ora_parse($cur, $sqlcomm, 0) or die ("Wrong statement: ".ora_error());
ora_exec($cur) or die ("Statement execution failed: ".ora_error());
if ($cur){
$numCols = ora_numcols( $cur );
while (ora_fetch($cur)) { // Get each row
$row = array();
for($i = 0; $i < $numCols; $i++){ // Loop through columns
$row[ora_columnname($cur,$i)] = ora_getcolumn($cur,$i);
$row[$i] = ora_getcolumn($cur, $i);
}
array_push($result, $row);
}
}
return $result;
}
this function will return an array with column id-s and column names too.