direi che nn è così.
eccoti un esempio concreto.
prima ti scarichi il pacchetto dalla sezione download (http://www.datatables.net/download/) e includi questi tre file:
Codice PHP:
<link rel="stylesheet" href="css/demo_table.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables.js"></script>
poi sempre nell'head:
Codice PHP:
<script type="text/javascript">
$(document).ready(function() {
$('#example').dataTable();
} );
</script>
infine la tabella:
Codice PHP:
<?php
echo '<div id="demo">';
echo '<table id="example" class="display"><thead>';
echo '<th></th>';
echo '<th>NOME</th>';
echo '<th>COGNOME</th>';
echo '<th>EMAIL</th>';
echo '<th>SETTORE</th>';
echo '<th>DATA</th>';
echo '<th></th></thead>';
echo '<tfoot>';
echo '<th>[url="javascript:selectAll();"]Select All[/url]</th>';
echo '<th>NOME</th>';
echo '<th>COGNOME</th>';
echo '<th>EMAIL</th>';
echo '<th>SETTORE</th>';
echo '<th>DATA</th>';
echo '<th></th></tfoot>';
foreach (showUtenti() as $row) {
echo '<tr><td></td>';
echo '<td>' . $row['utente_nome'] . '</td>';
echo '<td>' . $row['utente_cognome'] . '</td>';
echo '<td>' . $row['utente_email'] . '</td>';
echo '<td>' . $row['settore'] . '</td>';
echo '<td>' . $row['data'] . '</td>';
echo '<td><a href="modifica.php?id=' . $row['utente_id'] . '&n=' . $row['utente_nome'] . '&c=' . $row['utente_cognome'] . '&e=' . $row['utente_email'] . '&s='
. $row['id_settore'] . '&d=' . $row['data'] . '">Modifica</a> | ';
echo '[url="javascript:deleteConfirmation(' . $row['utente_id'] . ')"]Elimina[/url]</td></tr>';
}
echo '</table></div>';
?>
showUtenti() è la funzione che esegue la query.
ci deve essere anche il <div id="demo">