Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 需要帮助将mysqli_fetch_数组引用转换为相应的OCI引用吗_Php_Mysql_Oracle_Mysqli_Oracle Call Interface - Fatal编程技术网

Php 需要帮助将mysqli_fetch_数组引用转换为相应的OCI引用吗

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中

在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 = 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) : "&nbsp;") . "</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>';
}