note 52313 modified in function.ocifetchinto by sixd

From: Date: Sat, 14 Nov 2009 23:23:27 +0000
Subject: note 52313 modified in function.ocifetchinto by sixd
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-162911@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>"; } --was-- 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>"; } http://php.net/manual/en/function.ocifetchinto.php

« previous php.notes (#162911) next »