note 52313 added to function.ocifetchinto
| From: | jafar78 at comcast dot net | Date: | Wed, 27 Apr 2005 16:23:36 +0000 |
| Subject: | note 52313 added to function.ocifetchinto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88643@lists.php.net to get a copy of this message | ||
Hi, the following is a simple connect and select which creates a single elment array. One can also
create a multiDementional array out of this. I hope this can help.
<?php
$DB_USER="DB user name";
$DB_PASSWD="DB passwd";
$DB="TNS name of your DB";
$connection = OCILogon ($DB_USER, $DB_PASSWD, $DB);
if ($connection == false){
echo OCIError($connection)."<BR>";
exit();
}
$ColName="your col name";
$TableName="your table name";
$YourOrderby="your order by col";
$query = "SELECT $ColName from $TableName ORDER BY $yourOrderby";
$cursor = ociparse($connection, $query);
ociexecute($cursor);
$Rrows = ocifetchstatement($cursor, $results);
echo "Found: $Rrows results<br><br>\n";
$myarray = array ();
for ($i = 0; $i < $Rrows; $i++) {
$myarray[$i]= $results["$ColName"][$i];
};
//This will print all the elements in the array
//or you can print one element=$myarray[0]
for ($j=0; $j < $Rrows; $j++){
echo "myarrayElement$j=$myarray[$j]<br>";
}
----
Manual Page -- http://www.php.net/manual/en/function.ocifetchinto.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52313
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52313&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52313&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52313&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52313&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52313&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52313&report=yes
Search -- http://master.php.net/manage/user-notes.php