Description On Line Oracle SQL-Query-with-PHP ||
IIS in windows 7 ultimate workstation connecting as
$conn = oci_connect('scott', 'Son', 'localhost/orcl.gateway.2wire.net');
re-load()
||
SELECT * FROM emp
:" . $sql .""; $conn = oci_connect('scott', 'Son', 'localhost/orcl.gateway.2wire.net'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); echo" DB connected: querying a table
"; } $stmt = oci_parse($conn, $sql); oci_execute($stmt); echo "
"; echo "
"; $ncols = oci_num_fields($stmt); $nrows= oci_num_rows($stmt); for ($i = 1; $i <= $ncols; $i++) { $column_name = oci_field_name($stmt, $i); echo "
$column_name
"; } // echo "
\n"; // echo "
\n"; while($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) { echo "
\n"; foreach ($row as $item) { echo "
".($item !== null ? htmlentities($item, ENT_QUOTES):" ")."
\n"; } //foreach ends echo "
\n"; }//while block ends echo "
\n"; // echo " no of rows : ". oci_num_rows($stmt); oci_free_statement($stmt); oci_close($conn); echo "
Oracle db conection closed"; // } ?>