0
工作代碼 -連接到Oracle:使用PDO的作品,但使用oci_connect不
$dbh = new PDO('oci:dbname=localhost/XE', 'hr', 'hr');
$s = $dbh->prepare("select * from Employees");
$s->execute();
while (($r = $s->fetch(PDO::FETCH_ASSOC)) != false) {
echo htmlentities($r['FIRST_NAME']) . " " . $r['LAST_NAME'] . "<br>";
}
不工作密碼(錯誤,調用未定義的函數oci_connect(),oci_new_connect())
/*Using oci_connect */
$conn=oci_connect("hr","hr","localhost/XE");
If (!$conn)
echo 'Failed to connect to Oracle';
else
echo 'Succesfully connected with Oracle DB';
oci_close($conn);
/*Using oci_new_connect*/
$c = oci_new_connect('hr', 'hr', 'localhost/XE');
$s = oci_parse($c, 'select city from locations');
oci_execute($s);
while (($res = oci_fetch_array($s, OCI_ASSOC)) != false) {
echo htmlentities($res['CITY']) . "<br>";
}
的phpinfo作爲phpinfo details 我已經把instantclient在C 11g和設置PATH變量也
想盡instantclient擴展一個由單
- 延長= php_oci8.dll,
- 延長= php_oci8_11g.dll,
- extension = php_oci8_12c.dll
我使用Oracle 11g