How to use PHP & Oracle (oci8) Get Field Name This is the guideline/example scripts how to use PHP get table field name from Oracle database
ShotDev Focus:
- PHP & Oracle database get field name from table.
Example
php_oracle_list_table.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <? $objConnect = oci_connect("myuser","mypassword","TCDB"); $strSQL = "SELECT * FROM CUSTOMER"; $objParse = oci_parse ($objConnect, $strSQL); oci_execute ($objParse,OCI_DEFAULT); $intNumField = oci_num_fields($objParse); $i = 0; echo "<b>Table CUSTOMER have $intNumField Fields.</b><br>"; for($i=1;$i<$intNumField;$i++) { echo $i."=".oci_field_name($objParse,$i)." (".oci_field_type($objParse,$i).")<br>"; } oci_close($objConnect); ?> </body> </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_oracle_list_table.php
Screenshot