【发布时间】:2011-04-15 20:44:41
【问题描述】:
当我尝试循环获取数据时,我可以通过 php 从 oracle db 中检索数据,但它给了我错误
未定义索引:第 15 行 C:\xampp\htdocs\testing\test.php 中的 id
这是我的代码
<?php
$username = "kemo";
$password = "kemoacer77";
$server = "localhost/XE";
$conn = oci_connect($username, $password, $server);
if(!$conn){
die("connect error".oci_error());
}
$stid = oci_parse($conn, 'SELECT id, username FROM users');
oci_execute($stid);
while (($row = oci_fetch_array($stid, OCI_BOTH))) {
// Use the uppercase column names for the associative array indices
echo $row['id'] ;
echo $row['username'];
}
oci_free_statement($stid);
oci_close($conn);
?>
【问题讨论】: