heres my code
$database = '
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.28)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)';
$db = new PDO('oci:dbname='.$database, 'middleuser', '1');
$sth = $db->prepare('SELECT * from BD_CENTERDEPT');
$sth->execute();
while($row = $sth->fetch(PDO::FETCH_OBJ)) {
echo $row->NAME."\n";
}
no error shown, but why? i am using oracle instant client. i already created a path in environmental variables "C:\\xampp\\instantclient_12_1"
and already uncomment "extension=php_pdo_oci.dll" in my php.ini iam pretty sure that
BD_CENTERDEPT has NAME column and data on it.
no errors but no data shown? how do I know if I really connected to oracle database?
是的,我忘记了查询中的数据库名称:)必须是
$db->prepare('SELECT * from dbname.BD_CENTERDEPT')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.