Server-side processing

Server-side processing

Steve_SmithSteve_Smith Posts: 1Questions: 1Answers: 0

Hi

I am beginner to DataTables and have looked at the examples but I'm still confused as to how I should start using it in my setup. At the moment wherever tables are required I build them manually such as below.

Can someone please provide the simplest method to get me started on how I can convert the below table to be using DataTables?

At the moment I am limiting results to 10 rows as I do not have pagination (the reason I mainly need DataTables).

 ` <?php

  include('core/connection.php');

  if($conn){

  $stid = oci_parse($conn, "

    SELECT *
    FROM
    (
      SELECT Orders.OrderNo, Orders.PurchaseOrderNo, TO_CHAR(Orders.CreationDate, 'DD Mon'), TO_CHAR(Orders.DeliveryDateT,'DD Mon'), Order_Totals.Quantity, Order_Totals.Net
      FROM Orders, Order_Totals
      WHERE Orders.OrderNo = Order_Totals.OrderNo
      ORDER BY Orders.OrderNo DESC
    )
    WHERE ROWNUM <= 10

  ");
  oci_execute($stid);

  echo "<table class='table table-hover '>
        <thread>
        <tr>
        <th>Order No</th>
        <th>Purchase Order No</th>
        <th>Created On</th>
        <th>Deliver On</th>
        <th>Items</th>
        <th>Net Total</th>
        <th></th>
        </tr>
        </thread>
        <tbody>";

  while ($row = oci_fetch_array($stid, OCI_NUM)) {

    echo "<tr>";
    echo "<td><code>" . $row['0'] . "</code></td>";
    echo "<td>" . $row['1'] . "</td>";
    echo "<td>" . $row['2'] . "</td>";
    echo "<td>" . $row['3'] . "</td>";
    echo "<td>" . $row['4'] . "</td>";
    echo "<td>" . $row['5'] . "</td>";
    echo "</tr>";
    unset($row);

  }

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

  oci_free_statement($stid);
  oci_close($conn);

  }

  ?>`

Thanks

Steve

This discussion has been closed.