PHP Oracle Connection.
ODBC Einrichten Start --> Einstellungen --> Systemsteuerung --> Verwaltung --> Datenquellen (ODBC) --> System-DNS |
Hinzufügen |
als cndb.php speichern |
test_odbc;user;pass |
als oratest.php speichern |
<?php @$datei = fopen('cndb.php','r'); while(!feof($datei)) { $fline = fgets($datei); } $dbconn = explode(";",$fline); $odbc = $dbconn[0]; $dbName = $dbconn[1]; $pw = $dbconn[2]; fclose($datei); $conn = odbc_connect($odbc,$dbName,$pw); if(!$conn) { echo "Keine ODBC Verbindung zur Datenbank !"; } else { $selects = "SELECT * FROM TABELLE"; $ausgabe=odbc_exec($conn,$selects); if (!@$ausgabe) { $strErrorMessage = odbc_errormsg($conn); } else { $n = 0; $row = array(); $isinid = array(); while (odbc_fetch_into($ausgabe,$row,$n)) { array_push($isinid,$row); $n++; } } echo "<table border=1>"; for($i = 1; $i < count($isinid); $i++) { // $isinid[$i][0]..1..3.. Tabelle Spalten echo "<tr><td>".$i."</td><td>".$isinid[$i][0]."</td><td>".$isinid[$i][1]."</td><td>".$isinid[$i][2]."</td><td>".$isinid[$i][3]."</td><td></tr>"; } echo "</table>"; } $disconn = odbc_close_all(); ?> |