PHP HTML动态列标题

I am using the below code to make a HTML table. I searched online for PHP get column headings but couldn't find any information (only information on rows). Is it possible to use a while loop and print the column headings from the SQL instead of having them hardcoded as below?

Code

  $stid = oci_parse($conn, "

    SELECT *
    FROM
    (
     SELECT   orders.order_no, orders.porder_no, orders.date, order_totals.value
     FROM     orders, order_totals
     WHERE    orders.order_no = order_totals.order_no
     AND      orders.account_no = '" . $_SESSION['session_account'] . "'
     ORDER BY orders.order_no DESC
    )
    WHERE ROWNUM <= 15

  ");
  oci_execute($stid);

  echo "<table class='table'>
        <thread>
        <tr>
        <th>Order No</th>
        <th>Purchase Order No</th>
        <th>Date</th>
        <th>Value</th>
        </tr>
        </thread>
        <tbody>";

  while ($row = oci_fetch_array($stid, OCI_NUM)) {
      echo "<tr>";
      echo '<td><a href="view.php?id=' . $row[0] . '">' . $row[0] . '</a></td>';
      for ( $ii = 1; $ii < count($row); $ii++ ) {
          echo "<td>" . $row[$ii] . "</td>";
      }
      echo "</tr>";
  }

  echo "</tbody> </table>";

Use this code this may help you, use oci_field_name() to get the column name

  echo "<table class='table'>
            <thread>
            <tr>";
    $ncols = oci_num_fields($stid);// to get column number

    for ($i = 1; $i <= $ncols; $i++) {// index start from 1
        $column_name  = oci_field_name($stid, $i);

    echo "<th>".$column_name."</th>";

    }
    echo "</tr>
            </thread>
            <tbody>";

You are looking for column name property that is already made available by PHP MySQL or MySQLI or PDO APIs.

Here is an example - http://www.php.net/manual/en/function.mysql-field-name.php

Good luck.