note 25870 added to ref.oracle
| From: | thebestion at gmx dot de | Date: | Wed, 09 Oct 2002 14:48:41 +0000 |
| Subject: | note 25870 added to ref.oracle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37847@lists.php.net to get a copy of this message | ||
A simple function
# list query in array
#
# $conn: connection
# $query: query_string
#
# return: $templist[$row][$column]=$value;
function get_query($conn,$query){
$cursor = ora_open($conn);
ora_parse($cursor, $query) or die;
ora_exec($cursor);
$numcols = ora_numcols($cursor);
$i=0;
while(ora_fetch($cursor)){
for($column=0; $column < $numcols; $column++){
$colname = trim(ora_columnname($cursor, $column));
$data = trim(ora_getcolumn($cursor, $column));
$templist[$i][$colname]=$data;
}
$i++;
}
return $templist;
}
i.e.:
$conn = ora_plogon( "user", "passwd")or die;
$cursor = ora_open($conn);
ora_commitoff($conn);
$query = "SELECT * FROM table";
$result=get_query($conn,$query);
for($i=0;$result[$i];$i++){
echo $result[$i][column];
}
--
http://www.php.net/manual/en/ref.oracle.php
http://master.php.net/manage/user-notes.php?action=edit+25870
http://master.php.net/manage/user-notes.php?action=delete+25870
http://master.php.net/manage/user-notes.php?action=reject+25870