HI,everyone , I m stum in this question for long time, could somebody help me out, my output is success ,but the arrange in table is wrong.
below is my code..

      <?php 

          $no_pensyarah=$_SESSION['no_pengguna'];
          $tahunsemasa =date('Y');
          include '../includes/dbconnect.php';
          $sql_rekod = "SELECT a.*,b.nama_subjek,c.nama_kursus 
                        FROM info_subjek_pensyarah as a, subjek as b,kursus as c
                        WHERE a.kod_subjek = b.kod_subjek AND a.kod_kursus = c.kod_kursus AND tahun_bahagian LIKE '$tahunsemasa%' AND no_pensyarah = '$no_pensyarah'";                
          $result_rekod = mysql_query($sql_rekod) or die('Query failed. ' . mysql_error());

          $tmpCount = 1;
          while($row = mysql_fetch_assoc($result_rekod)) {?> 

          <?php $nama_kelas = $row['nama_kelas']; ?>

          <tr>
            <td><?php echo $tmpCount; ?></td>
            <td><?php echo $row['kod_kursus']; ?></td>
            <td><?php echo $row['nama_kursus']; ?></td>
            <td><?php echo $row['kod_subjek']; ?></td>
            <td><?php echo $row['nama_subjek']; ?></td>
            <td><?php echo " <a href='kehadiran.php?nama_kelas=$nama_kelas '>" . $row['nama_kelas'] . "</a> ";?></td>
            <td><?php echo $row['tahun_bahagian']; ?></td>

            -------------------------------------------------------------------------------------------------------------------------------------------------------------------

 <?php 
 $nama_kelas = $_GET['nama_kelas'];
 echo $_GET['nama_kelas']; 
 $sql_rekod = " SELECT `nama_pelajar`, `kod_kursus`, `nama_kelas`, `status`,`aras` FROM pelajar WHERE nama_kelas = '$nama_kelas'";            
$result_rekod = mysql_query($sql_rekod) or die('Query failed. ' . mysql_error());
 $tmpCount = 1;
 while($row = mysql_fetch_assoc($result_rekod)) {?>   
 <tr>
            <td><?php echo $tmpCount; ?></td>
            <td><?php echo $row['nama_pelajar'];?></td>
            <td><?php echo $row['kod_kursus']; ?></td>
            <td><?php echo $row['nama_kelas'];?><td>
            <td><?php echo $row['status']; ?></td>
            <td><?php echo $row['aras']; ?></td>
            <td>
              <a href="hapus_pelajar.php?id=<?php echo $row['nama_pelajar']; ?>"data-toggle="modal" <i class="icon-remove"></i></a>
            </td>
          </tr> 
          <?php $tmpCount++; } 

      ?>  

It looks like you are missing a closing <tr> attribute in your first table field.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.