note 100304 added to function.oci-fetch-assoc
| From: | dbernhardt129 at gmail dot com | Date: | Wed, 06 Oct 2010 21:11:12 +0000 |
| Subject: | note 100304 added to function.oci-fetch-assoc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173043@lists.php.net to get a copy of this message | ||
Here's a simple example of using the oci_fetch_assoc function for anyone who would like to see
it.
$oconn = oci_connect('ora_user','ora_pass','ora_inst');
if (!$oconn){
$msg = "Cannot connect to Oracle ".oci_error();
} else {
$msg = "Connected to Oracle";
}
$select_stmt = "select username from user_table";
$stid = oci_parse($oconn, $select_stmt);
oci_execute($stid);
echo "<table border='1'>\n";
while ($row = oci_fetch_assoc($stid)) {
echo "<tr>\n";
echo "<td>". $row["USERNAME"] . "</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
oci_free_statement($stid);
oci_close($oconn);
Make sure you capitalize the column name for referencing the item in the associative array. Of
course, this is just a simple example and you might want to do some processing on the data prior to
output, but you get the idea here.
----
Server IP: 64.71.164.2
Probable Submitter: 130.111.216.152
----
Manual Page -- http://www.php.net/manual/en/function.oci-fetch-assoc.php
Edit -- https://master.php.net/note/edit/100304
Del: integrated -- https://master.php.net/note/delete/100304/integrated
Del: useless -- https://master.php.net/note/delete/100304/useless
Del: bad code -- https://master.php.net/note/delete/100304/bad+code
Del: spam -- https://master.php.net/note/delete/100304/spam
Del: non-english -- https://master.php.net/note/delete/100304/non-english
Del: in docs -- https://master.php.net/note/delete/100304/in+docs
Del: other reasons-- https://master.php.net/note/delete/100304
Reject -- https://master.php.net/note/reject/100304
Search -- https://master.php.net/manage/user-notes.php