我正在尝试将oracle的order by语句绑定到变量,因此我可以对表进行排序但它不起作用。如果我回应我的语句“$ m_sql”它实际上回应:order_by而不是我分配给它的变量。请帮忙。
$m_sql = "SELECT CONTROL_ID, CONTROL_ID2 order by :order_by";
$doc = ociparse($conn, $m_sql);
oci_bind_by_name( $doc, ':order_by', $_GET['ORDER_BY'] );
ociexecute($doc);
oci_fetch_all($doc, $res, 0, 2000, OCI_FETCHSTATEMENT_BY_ROW);
foreach ($res as $col) {
echo "<tr>\n";
foreach ($col as $item) {
echo " <td>". $item . "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
oci_free_statement($doc);
oci_close($conn);