Datatables console error jQuery.Deferred exception: Cannot set property '_DT_CellIndex' Ask

Datatables console error jQuery.Deferred exception: Cannot set property '_DT_CellIndex' Ask

moningmoning Posts: 1Questions: 1Answers: 0

my datatables didn't work and i get console error Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined but when i delete the query inside tbody its working fine.

<table class="table table-bordered table-striped table-fixed text-center" id="myTable">
                <thead>
                  <tr>
                    <th>No</th>
                    <th>ID</th>
                    <th>Nama</th>
                    <th>Golongan</th>
                    <th>Nilai Output</th>
                    <th>Penilaian Atasan</th>
                    <th>Nilai Learning</th>
                    <th>Nilai Kedisiplinan</th>
                    <th>Nilai 5R</th>
                    <th>Hasil</th>
                    <th>Tanggal</th>
                  </tr>
                </thead>
                  <!-- query -->
                  <?php
                  $no = 0;
                  $query = "SELECT * FROM user 
                            where id= $_SESSION[id]";

                  $query = "SELECT user.id,user.nama,golongan,nilai_output,nilai_atasan,nilai_learning,nilai_kedisiplinan,nilai_5r,overall,tanggal 
                            FROM tkaryawan 
                            JOIN user 
                            ON user.id=tkaryawan.id 
                            where user.id= $_SESSION[id] 
                            ORDER BY tanggal DESC";

                  $result = mysqli_query($koneksi, $query);
                  
                  if(!$result){
                    die ("Query Error: ".mysqli_errno($koneksi).
                    " - ".mysqli_error($koneksi));
                  }
                  while($data = mysqli_fetch_assoc($result))
                  {
                    $no++;
                    ?>
                  <tbody>
                    <tr>
                      <td><?php echo $no;?></td>
                      <td><?php echo $data['id'];?></td>
                      <td class="text-capitalize"><?php echo $data['nama'];?></td>
                      <td><?php echo $data['golongan'];?></td>
                      <td><?php echo $data['nilai_output'];?></td>
                      <td><?php echo $data['nilai_atasan'];?></td>
                      <td><?php echo $data['nilai_learning'];?></td>
                      <td><?php echo $data['nilai_kedisiplinan'];?></td>
                      <td><?php echo $data['nilai_5r'];?></td>
                      <td class="font-weight-bold text-danger"><?php echo $data['overall'];?></td>
                      <td class="text-secondary"><?php echo $data['tanggal'];?></td>
                    <tr>
                  </tbody>
                  <?php
                  }
                  // free the memory 
                  mysqli_free_result($result);
                  // close conection
                  mysqli_close($koneksi);
                  ?>
              </table>

Answers

  • colincolin Posts: 9,780Questions: 0Answers: 1,619

    It's because you're mixing PHP in the browser, which isn't possible - see here.

    Colin

Sign In or Register to comment.