problem datatable dynamic

problem datatable dynamic

math44infomath44info Posts: 2Questions: 2Answers: 0

When I link datatables to a database
show This the problem

DataTables warning: table id=example - Requested unknown parameter '0' for row 0. For more information about this error, please see http://datatables.net/tn/4

<!DOCTYPE html>
<html>
<head>
<link href="//datatables.net/download/build/nightly/jquery.dataTables.css" rel="stylesheet" type="text/css" />

    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="//datatables.net/download/build/nightly/jquery.dataTables.js?latest"></script>

    <link href="//datatables.net/download/build/dataTables.colVis.nightly.css?_=4c7fa7e11152715969bcdc821ce0fec1.css" rel="stylesheet" type="text/css" />
    <script src="//datatables.net/download/build/dataTables.colVis.nightly.js?_=4c7fa7e11152715969bcdc821ce0fec1"></script>
    <link href="//datatables.net/download/build/dataTables.colReorder.nightly.css?_=e3368f47ca414b214832b72214db29d1.css" rel="stylesheet" type="text/css" />
    <script src="//datatables.net/download/build/dataTables.colReorder.nightly.js?_=e3368f47ca414b214832b72214db29d1"></script>

    <meta charset=utf-8 />
    <title>DataTables - JS Bin</title>




</head>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
    <tr>

                                        <th>Coef</th>
                   <th>nom_etud</th>
                                        <th>prenom_etud</th>

    </tr>
</thead>

<tfoot>
    <tr>
       <th>Cours</th>
                                        <th>Coef</th>
                 <th>nom</th>
                                        <th>prenom</th>

    </tr>
</tfoot>

<tbody>
    <tr>
  <?php

$strSQL = " Coef , nom , prenom from from class where id = 'user' " ;
$rs = mysql_query($strSQL);

    if($rs === FALSE) {
die(mysql_error()); // TODO: better error handling

}

while($row = mysql_fetch_array($rs)) {

echo "<tr>";
echo "<td>" . $row['cod'] . "</td>";
echo "<td>" . $row['nom'] . "</td>";
echo "<td>" . $row['prenom '] . "</td>";
}
mysql_close();

                                     ?> 
    </tr>

</tbody>

</table>
</div>

     <script type="text/javaScript">

$(document).ready(function() {
var table = $('#example').DataTable( {
dom: 'RC<"clear">lfrtip',
columnDefs: [
{ visible: false, targets: 1 }
]
} );
}
);

Please help me ??

</script>

</body>

</html>

Answers

  • rhinorhino Posts: 80Questions: 2Answers: 17

    Would you mind trying to clear that up a little? It's quite hard to decipher...

This discussion has been closed.