could help me with an example and explanation of how to display the data of a query in a DataTable, for the moment it shows me the results in a conventional table. I have the following code:
$query="SELECT art_Clave, art_Costo, kar_Fecha, kar_Cantidad, kar_Origen, alma_Existencia, usu_Clave FROM tArticuloKardex WHERE art_Clave='".$buscar."' AND (kar_Fecha BETWEEN '".$formato1."' AND '".$formato2."') ORDER BY kar_Fecha";
$resultado=sqlsrv_query($conn, $query);
//se desplegaran los resultados en la tabla
echo "<table border=1>";
echo "<tr>";
echo "<th>SKU</th>";
echo "<th>COSTO</th>";
echo "<th>FECHA DE MOVIMIENTO</th>";
echo "<th>PIEZAS</th>";
echo "<th>TICKET</th>";
echo "<th>EXISTENCIA FINAL</th>";
echo "<th>USUARIO</th>";
echo "</tr>";
while($row=sqlsrv_fetch_array($resultado)){
echo '<tr>';
echo '<td>'.$row['art_Clave'].'</td>';
echo '<td>'.$row['art_Costo'].'</td>';
echo '<td>'.date_format($row['kar_Fecha'], 'd-m-Y').'</td>';
echo '<td>'.$row['kar_Cantidad'].'</td>';
echo '<td>'.$row['kar_Origen'].'</td>';
echo '<td>'.$row['alma_Existencia'].'</td>';
echo '<td>'.$row['usu_Clave'].'</td>';
echo '</tr>';
}
echo "</table>";'