如何在PHP中使用Oracle数据库(6)
程序员文章站
2022-07-02 21:29:25
利用oci列出全部数据表'email_info'中的数据 同上,只不过用oci来写 相关php代码: putenv("oracle_sid=...
利用oci列出全部数据表'email_info'中的数据
同上,只不过用oci来写
相关php代码:
putenv("oracle_sid=orasid");
$connection = ocilogon ("username","password");
if ($connection == false){
echo ocierror($connection)."
";
exit;
}
$query = "select * from email_info";
$cursor = ociparse ($connection, $query);
if ($cursor == false){
echo ocierror($cursor)."
";
exit;
}
$result = ociexecute ($cursor);
if ($result == false){
echo ocierror($cursor)."
";
exit;
}
echo " ";
echo " full name email address
";
while (ocifetchinto ($cursor, $values)){
$name = $values[0];
$email = $values[1];
echo " $name $email
";
}
echo " ";
ocilogoff ($connection);
?>
程序运行的浏览效果如下所示:
姓名 email 地址
春花 springflower@163.com
秋月 autumnmoon@163.com
... ...
同上,只不过用oci来写
相关php代码:
putenv("oracle_sid=orasid");
$connection = ocilogon ("username","password");
if ($connection == false){
echo ocierror($connection)."
";
exit;
}
$query = "select * from email_info";
$cursor = ociparse ($connection, $query);
if ($cursor == false){
echo ocierror($cursor)."
";
exit;
}
$result = ociexecute ($cursor);
if ($result == false){
echo ocierror($cursor)."
";
exit;
}
echo " ";
echo " full name email address
";
while (ocifetchinto ($cursor, $values)){
$name = $values[0];
$email = $values[1];
echo " $name $email
";
}
echo " ";
ocilogoff ($connection);
?>
程序运行的浏览效果如下所示:
姓名 email 地址
春花 springflower@163.com
秋月 autumnmoon@163.com
... ...
上一篇: CSS实现三列布局
下一篇: html+css布局整理笔记