Php 需要帮助将mysqli_fetch_数组引用转换为相应的OCI引用吗
在MySQL数据库上,我使用以下PHP代码成功检索行并将两列的内容放入表中:Php 需要帮助将mysqli_fetch_数组引用转换为相应的OCI引用吗,php,mysql,oracle,mysqli,oracle-call-interface,Php,Mysql,Oracle,Mysqli,Oracle Call Interface,在MySQL数据库上,我使用以下PHP代码成功检索行并将两列的内容放入表中: while ($row = mysqli_fetch_array($query)) { echo '<tr> <td>'.$row['sc_service'].'</td> <td>'.$row['sc_color'].'</td> </tr>'; } Oracle中的字段名通常为大写,PHP中
while ($row = mysqli_fetch_array($query))
{
echo '<tr>
<td>'.$row['sc_service'].'</td>
<td>'.$row['sc_color'].'</td>
</tr>';
}
Oracle中的字段名通常为大写,PHP中的数组键区分大小写:
while (($row = oci_fetch_array($stid1, OCI_BOTH))!= false)
{
echo '<tr>
<td>'.$row['SC_SERVICE'].'</td>
<td>'.$row['SC_COLOR'].'</td>
</tr>';
}
while($row=oci\u fetch\u数组($stid1,oci\u两者))!=false)
{
回声'
“.$row['SC_服务']”
“.$row['SC_COLOR']”
';
}
我将小写改为大写,这就纠正了我的问题。非常感谢!
<?php include 'database.php'; ?> // my Oracle database oci_connect call
<?php
$stid = oci_parse($connect, 'SELECT * FROM service_color');
if (!$stid) {
$e = oci_error($connect);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$r = oci_execute($stid);
if (!$r) {
$e = oci_error($stid);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
print "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
print "<tr>\n";
foreach ($row as $item) {
print " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>\n";
}
print "</tr>\n";
}
print "</table>\n";
oci_free_statement($stid);
oci_close($connect);
while (($row = oci_fetch_array($stid1, OCI_BOTH))!= false)
{
echo '<tr>
<td>'.$row['SC_SERVICE'].'</td>
<td>'.$row['SC_COLOR'].'</td>
</tr>';
}