hello everyone, i had to make a new system for practicum student system

this is coding for view student that has been registered. first of all sorry fpr the keywprd that you dont understand cause i am Malaysian

`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" method="post" action="">


          <fieldset>

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body>
    <form id="form1" method="post" action="">
          <fieldset>
          <legend>SENARAI PELAJAR PRAKTIKAL</legend>
          <p align="left">Halaman ini memaparkan senarai pelajar praktikal yang telah didaftarkan.</p>
          <p align="left">
            <?php
            $query = mysql_query("SELECT * FROM pelajarpraktikal"); //Counting total number of rows in the table 'data',
      $total_rows = mysql_num_rows($query);
      $base_url = 'senaraipelajar.php';    //Provide location of you index file  
      $per_page = 10;                           //number of results to shown per page 
      $num_links = 8;                           // how many links you want to show
      $total_rows = $total_rows; 
      $cur_page = 1; 
    if(isset($_GET['page']))
        {
          $cur_page = $_GET['page'];
          $cur_page = ($cur_page < 1)? 1 : $cur_page;            //if page no. in url is less then 1 or -ve
        }
        // calculate limit and offset, it'll will be used for Sql Query//
    //step:5
        $offset = ($cur_page-1)*$per_page;                //setting offset

        $pages = ceil($total_rows/$per_page);              // no of page to be created
        //Calculate the start and end page numbers for pagination links//
    //step:6

        $start = (($cur_page - $num_links) > 0) ? ($cur_page - ($num_links - 1)) : 1;
        $end   = (($cur_page + $num_links) < $pages) ? ($cur_page + $num_links) : $pages;
        //query the database with calculated OFFSET //
    //step:7
        $res = mysql_query("SELECT * FROM pelajarpraktikal LIMIT ".$per_page." OFFSET ".$offset);
    if(isset($res))// results from Step 7
            {
    //$sql_list = "SELECT kodfail, namafail, kabinet, kategori,status FROM fail"; 
    //$rs_list = mysql_query($sql_list); 
         ?>
          </p>
          <table width="125" align="right">
            <tr>
              <td width="172"><span class="style9">Jumlah Rekod</span>:<?php echo $total_rows ?></td>
            </tr>
          </table>
          <table width="671" table="table" id="table1" class="tabletry">
            <tr>
              <td width="28" bgcolor="#CCCCCC"><div align="left" class="style9"><strong>Bil</strong></div></td>
              <td width="137" bgcolor="#CCCCCC"><div align="center" class="style9"><strong>No IC</strong></div></td>
              <td width="415" bgcolor="#CCCCCC"><div align="center" class="style9"><strong>Nama Pelajar</strong></div></td>
              <td colspan="2" bgcolor="#CCCCCC"><div align="center" class="style9"><strong>Tindakan</strong></div></td>
            </tr>
            <?php

                while($rowlist = mysql_fetch_array($res)){ 
             $offset++; 
        ?>
            <tr>
              <td height="27"><?php echo $offset?></td>
              <td class="style9"><a href="viewpelajar.php?noic=<?php echo $rowlist['noic']; ?>" style="text-decoration: none"><?php echo $rowlist['noic'];?></a></td>
              <td class="style9"><?php echo $rowlist['namapelajar'];?></td>
              <td width="24" style="border-right:hidden">
                <input name="btn_continue" type="button" value="Kemaskini" onclick="location.href='kemaskinipelajar.php?noic=<?php echo $rowlist['noic'];?>'" align="right"/></td>
              <td width="43"><span class="style9">
              <a href="proses_deletepelajar.php?noic=<?php echo $rowlist['noic']; ?>"><input name="delete" type="button" value="Padam" onclick="return confirm('Padam Maklumat Pelajar ini?')" align="right"/></td>
            </tr>
            <?php
                } 
            }
                           ?>
            <div id="pagination">
              <div id="pagiCount">
                <?php
                    if(isset($pages))
                    {  
                        if($pages > 1)        
                        {    if($cur_page > $num_links)     // for taking to page 1 //
                            {   $dir = "first";
                                echo '<span id="prev"> <a href="'.$_SERVER['PHP_SELF'].'?page='.(1).'">'.$dir.'</a> </span>';
                            }
                           if($cur_page > 1) 
                            {
                                $dir = "prev";
                                echo '<span id="prev"> <a href="'.$_SERVER['PHP_SELF'].'?page='.($cur_page-1).'">'.$dir.'</a> </span>';
                            }                 

                            for($x=$start ; $x<=$end ;$x++)
                            {

                                echo ($x == $cur_page) ? '<strong>'.$x.'</strong> ':'<a href="'.$_SERVER['PHP_SELF'].'?page='.$x.'">'.$x.'</a> ';
                            }
                            if($cur_page < $pages )
                            {   $dir = "next";
                                echo '<span id="next"> <a href="'.$_SERVER['PHP_SELF'].'?page='.($cur_page+1).'">'.$dir.'</a> </span>';
                            }
                            if($cur_page < ($pages-$num_links) )
                            {   $dir = "last";

                                echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$pages.'">'.$dir.'</a> '; 
                            }   
                        }
                    }
                ?>
              </div>
            </div>
          </table>
          <table width="125" align="right">
            <tr>
              <td width="172"> </td>
            </tr>
          </table>
          </fieldset>
        </form>
    </body>
    </html>




      <legend>SENARAI PELAJAR PRAKTIKAL</legend>
      <p align="left">Halaman ini memaparkan senarai pelajar praktikal yang telah didaftarkan.</p>
      <p align="left">
        <?php
        $query = mysql_query("SELECT * FROM pelajarpraktikal"); //Counting total number of rows in the table 'data',
  $total_rows = mysql_num_rows($query);
  $base_url = 'senaraipelajar.php';    //Provide location of you index file  
  $per_page = 10;                           //number of results to shown per page 
  $num_links = 8;                           // how many links you want to show
  $total_rows = $total_rows; 
  $cur_page = 1; 
if(isset($_GET['page']))
    {
      $cur_page = $_GET['page'];
      $cur_page = ($cur_page < 1)? 1 : $cur_page;            //if page no. in url is less then 1 or -ve
    }
    // calculate limit and offset, it'll will be used for Sql Query//
//step:5
    $offset = ($cur_page-1)*$per_page;                //setting offset

    $pages = ceil($total_rows/$per_page);              // no of page to be created
    //Calculate the start and end page numbers for pagination links//
//step:6

    $start = (($cur_page - $num_links) > 0) ? ($cur_page - ($num_links - 1)) : 1;
    $end   = (($cur_page + $num_links) < $pages) ? ($cur_page + $num_links) : $pages;
    //query the database with calculated OFFSET //
//step:7
    $res = mysql_query("SELECT * FROM pelajarpraktikal LIMIT ".$per_page." OFFSET ".$offset);
if(isset($res))// results from Step 7
        {
//$sql_list = "SELECT kodfail, namafail, kabinet, kategori,status FROM fail"; 
//$rs_list = mysql_query($sql_list); 
     ?>
      </p>
      <table width="125" align="right">
        <tr>
          <td width="172"><span class="style9">Jumlah Rekod</span>:<?php echo $total_rows ?></td>
        </tr>
      </table>
      <table width="671" table="table" id="table1" class="tabletry">
        <tr>
          <td width="28" bgcolor="#CCCCCC"><div align="left" class="style9"><strong>Bil</strong></div></td>
          <td width="137" bgcolor="#CCCCCC"><div align="center" class="style9"><strong>No IC</strong></div></td>
          <td width="415" bgcolor="#CCCCCC"><div align="center" class="style9"><strong>Nama Pelajar</strong></div></td>
          <td colspan="2" bgcolor="#CCCCCC"><div align="center" class="style9"><strong>Tindakan</strong></div></td>
        </tr>
        <?php

            while($rowlist = mysql_fetch_array($res)){ 
         $offset++; 
    ?>
        <tr>
          <td height="27"><?php echo $offset?></td>
          <td class="style9"><a href="viewpelajar.php?noic=<?php echo $rowlist['noic']; ?>" style="text-decoration: none"><?php echo $rowlist['noic'];?></a></td>
          <td class="style9"><?php echo $rowlist['namapelajar'];?></td>
          <td width="24" style="border-right:hidden">
            <input name="btn_continue" type="button" value="Kemaskini" onclick="location.href='kemaskinipelajar.php?noic=<?php echo $rowlist['noic'];?>'" align="right"/></td>
          <td width="43"><span class="style9">
          <a href="proses_deletepelajar.php?noic=<?php echo $rowlist['noic']; ?>"><input name="delete" type="button" value="Padam" onclick="return confirm('Padam Maklumat Pelajar ini?')" align="right"/></td>
        </tr>
        <?php
            } 
        }
                       ?>
        <div id="pagination">
          <div id="pagiCount">
            <?php
                if(isset($pages))
                {  
                    if($pages > 1)        
                    {    if($cur_page > $num_links)     // for taking to page 1 //
                        {   $dir = "first";
                            echo '<span id="prev"> <a href="'.$_SERVER['PHP_SELF'].'?page='.(1).'">'.$dir.'</a> </span>';
                        }
                       if($cur_page > 1) 
                        {
                            $dir = "prev";
                            echo '<span id="prev"> <a href="'.$_SERVER['PHP_SELF'].'?page='.($cur_page-1).'">'.$dir.'</a> </span>';
                        }                 

                        for($x=$start ; $x<=$end ;$x++)
                        {

                            echo ($x == $cur_page) ? '<strong>'.$x.'</strong> ':'<a href="'.$_SERVER['PHP_SELF'].'?page='.$x.'">'.$x.'</a> ';
                        }
                        if($cur_page < $pages )
                        {   $dir = "next";
                            echo '<span id="next"> <a href="'.$_SERVER['PHP_SELF'].'?page='.($cur_page+1).'">'.$dir.'</a> </span>';
                        }
                        if($cur_page < ($pages-$num_links) )
                        {   $dir = "last";

                            echo '<a href="'.$_SERVER['PHP_SELF'].'?page='.$pages.'">'.$dir.'</a> '; 
                        }   
                    }
                }
            ?>
          </div>
        </div>
      </table>
      <table width="125" align="right">
        <tr>
          <td width="172"> </td>
        </tr>
      </table>
      </fieldset>
    </form>
</body>
</html>`

THE ERROR IS

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in .... line 16
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in .... line 60

please help me i have to submit this system before 17 April 2015 :(

Since that is your error

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in .... line 16
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in .... line 60

It says it cannot find a match or data in your database table have you checked if your table has any data?

Member Avatar for diafol

Please stop using mysql_* functions. They have been deprecated for some time. Use mysqli or PDO.

Do

$res = mysql_query("SELECT * FROM pelajarpraktikal LIMIT ".$per_page." OFFSET ".$offset) or die(mysql_error());

and post the error message here.

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.