reg.php

<?php require_once('Connections/iventori.php'); ?>

<?php
$currentPage = $_SERVER["PHP_SELF"];
    //$tarikh=gmdate("j F y",time()+(28800));

$maxRows_Recordset2 = 10;
$pageNum_Recordset2 = 0;
if (isset($_GET['pageNum_Recordset2'])) {
  $pageNum_Recordset2 = $_GET['pageNum_Recordset2'];
}
$startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2;

mysql_select_db($database_pinjaman, $pinjaman);
$query_Recordset2 = "SELECT no_inventori,model FROM inventori WHERE peralatan='laptop'";
$query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);
$Recordset2 = mysql_query($query_limit_Recordset2, $pinjaman) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);

if (isset($_GET['totalRows_Recordset2'])) {
  $totalRows_Recordset2 = $_GET['totalRows_Recordset2'];
} else {
  $all_Recordset2 = mysql_query($query_Recordset2);
  $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);
}
$totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;

$maxRows_Recordset3 = 10;
$pageNum_Recordset3 = 0;
if (isset($_GET['pageNum_Recordset3'])) {
  $pageNum_Recordset3 = $_GET['pageNum_Recordset3'];
}
$startRow_Recordset3 = $pageNum_Recordset3 * $maxRows_Recordset3;

$colname_Recordset3 = "-1";
if (isset($_GET['any'])) {
  $colname_Recordset3 = (get_magic_quotes_gpc()) ? $_GET['any'] : addslashes($_GET['any']);
}
mysql_select_db($database_pinjaman, $pinjaman);
$query_Recordset3 = sprintf("SELECT * FROM inventori WHERE peralatan = '%s'", $colname_Recordset3);
$query_limit_Recordset3 = sprintf("%s LIMIT %d, %d", $query_Recordset3, $startRow_Recordset3, $maxRows_Recordset3);
$Recordset3 = mysql_query($query_limit_Recordset3, $pinjaman) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);

if (isset($_GET['totalRows_Recordset3'])) {
  $totalRows_Recordset3 = $_GET['totalRows_Recordset3'];
} else {
  $all_Recordset3 = mysql_query($query_Recordset3);
  $totalRows_Recordset3 = mysql_num_rows($all_Recordset3);
}
$totalPages_Recordset3 = ceil($totalRows_Recordset3/$maxRows_Recordset3)-1;

$queryString_Recordset2 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset2") == false && 
        stristr($param, "totalRows_Recordset2") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset2 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);
    ?>

<!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=iso-8859-1" />
<title>Sistem e-Pinjaman</title>
<style type="text/css">
<!-- 
body {
background-image: url(image/background.jpg);
}
.style3 {font-family: "Times New Roman";font-size: 14px;color: #000000;    }
.style1 {
    font-family: "Times New Roman";
    font-size: 16px;
    color: #000000;
    font-weight:bold;

}
.style12{font-family: "Times New Roman";font-size: 18px;color: #000000;font-weight:bold;}

-->

   /* Begin Navigation Bar Styling */
   #nav {
      width: 100%;
      float: left;
      margin: 0 0 3em 0;
      padding: 0;
      list-style: none;
      background-color: #FFFF66;
      border-bottom: 1px solid #ccc; 
      border-top: 1px solid #ccc; }
   #nav li {
      float: left; }
   #nav li a {
      display: block;
      padding: 8px 15px;
      text-decoration: none;
      font-weight: bold;
      color: #069;
      border-right: 1px solid #ccc; }
   #nav li a:hover {
      color: #c00;
      background-color: #fff; }
   /* End navigation bar styling. */

   /* This is just styling for this specific page. */
   body {
      background-color: #555; 
      font: small/1.3 Arial, Helvetica, sans-serif; }
   #wrap {
      width: 871px;
      margin: 0 auto;
      background-color: #fff; }
   h1 {
      font-size: 1.5em;
      padding: 1em 8px;
      color: #333;
      background-color: #069;
      margin: 0; }
   #content {
      padding: 0 50px 50px; }

.style15 {font-family: "Times New Roman"; font-size: 16px; color: #FFFF33; font-weight: bold; }
.style17 {font-family: "Times New Roman"; font-size: 14px; color: #FFFF33; }
</style></head>

<body>

<style type="text/css">
<!-- 
body {
background-image: url(image/background.jpg);
}
.style3 {font-family: "Times New Roman";font-size: 14px;color: #000000;    }
.style1 {
    font-family: "Times New Roman";
    font-size: 16px;
    color: #000000;
    font-weight:bold;

}
.style12{font-family: "Times New Roman";font-size: 18px;color: #000000;font-weight:bold;}

-->
</style>

<table width="883" height="450" border="0" align="center" bgcolor="#FFFFCC">
  <tr>
    <td colspan="2"><img src="image/banner.jpg" width="871" height="122" /></td>
  </tr>

  <tr><!--menubar-->
    <th><!--menubar-->
    <div id="wrap"><!--menubar-->
     <ul id="nav"><!--menubar-->
      <li><a href="index.php" class="style1">Laman Utama</a></li><!--menubar-->
      <li><a href="pinjaman_1.php" class="style1">Pinjaman</a></li><!--menubar-->
      <li><a href="#" class="style1">Tempahan</a></li><!--menubar-->
      <li><a href="listperalatanpage.php" class="style1">List peralatan</a></li><!--menubar-->
      <li><a href="daftar_1.php" class="style1">Daftar Peralatan</a></li><!--menubar-->
      <li><a href="staff_daftar.php" class="style1">Daftar Pengguna</a></li><!--menubar-->
      <li><a href="logmasuk.php" class="style1">Log Masuk</a></li><!--menubar-->
     </ul><!--menubar-->
   </div><!--menubar-->
    </th><!--menubar-->
  </tr><!--menubar-->

    <tr><!--time&date-->
    <th width="872" align="right" span class="style1"><!--time&date-->
    <?php $today = gmdate("j F Y, g:i a",time()+(28800)); ?><!--time&date-->
    <?php echo $today;?></th><!--time&date-->
    </tr><!--time&date-->

 <tr>
      <td width="872" height="350"><p align="center" class="style12">SENARAI PERALATAN</p>


    <form id="form1" name="form1" method="get" action=""><!--carian-->
        <table width="346" border="0" align="center"><!--carian-->
            <tr><!--carian-->
                <td height="21" colspan="3" class="style53" align="center">**Carian (cth: LAPTOP)</td><!--carian-->
                    </tr><!--carian-->
                        <tr bgcolor="#FFFF66"><!--carian-->
                            <td width="219" height="33" class="style49"><div align="center"><!--carian-->
                                <input name="any" type="text" id="any" size="25" /></div></td><!--carian-->
                                    <td width="117" class="style15"><div align="center"><!--carian-->
                                        <input type="submit" name="Submit" value="search" /></div></td></tr><!--carian-->
                                            </table></form><!--carian-->
                                                <br /><!--carian-->


<!-- Recordset2 -->
<?php if ($totalRows_Recordset2 > 0 && $totalRows_Recordset3 == 0) { // Show if recordset not empty ?>
    <table width="442" border="1" align="center">
        <tr bgcolor="#006600">
            <th width="128" scope="col"><span class="style17">Laptop</span></th>
                <th width="164" scope="col"><span class="style17">Extension</span></th>
                    </tr> 

<?php do { ?>
    <tr bgcolor="#FFCC66" class="style3">
        <td scope="row"><div align="center"><a href="daftar_detail.php?no_inventori=<?php echo $row_Recordset2['no_inventori']; ?>"><?php echo $row_Recordset2['no_inventori']; ?></a></div></td>
            <td><div align="center"><?php echo $row_Recordset2['peralatan']; ?></div></td></tr>
                <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>
                    </table><br />

    <div align="center"><a href="<?php printf("%s?pageNum_Recordset2=%d%s", $currentPage, max(0, $pageNum_Recordset2 - 1), $queryString_Recordset2); ?>">Previous</a>
        | <a href="<?php printf("%s?pageNum_Recordset2=%d%s", $currentPage, min($totalPages_Recordset2, $pageNum_Recordset2 + 1), $queryString_Recordset2); ?>">Next</a>
<!-- End Recordset2 -->  

<!-- Recordset 3 -->
            <?php } // Show if recordset not empty ?>
                <?php if ($totalRows_Recordset3 > 0) { // Show if recordset not empty ?>
                    <table width="442" border="1" align="center">
                        <tr bgcolor="#006600">
                            <th width="128" scope="col"><span class="style17">No Inventori</span></th>
                                <th width="164" scope="col"><span class="style17">Peralatan</span></th></tr> 

  <?php do { ?>
            <tr bgcolor="#FFCC66" class="style3">
              <td scope="row"><div align="center"><a href="daftar_detail.php?no_inventori=<?php echo $row_Recordset3['no_inventori']; ?>"><?php echo $row_Recordset3['no_inventori']; ?></a></div></td>
                <td><div align="center"><?php echo $row_Recordset3['peralatan']; ?></div></td></tr>
                    <?php } while ($row_Recordset3 = mysql_fetch_assoc($Recordset3)); ?>
                        </table>

                    <?php } // Show if recordset not empty ?>
<!-- End Recordset 3 -->

  </div>
                  <p align="center" class="style46">-: <a href="listperalatanpage.php">List Peralatan</a> :- </p>
                  <p class="style46">&nbsp;</p>
    </fieldset>
  </tr>  
</table></td>
</table>

<?php
    function redirect($url){ 
            die('<meta http-equiv="refresh" content="0;URL='.$url.'">'); 
     }
?>

</body>
</html>
<?php

mysql_free_result($Recordset2);

mysql_free_result($Recordset3);


?>

the current output is

EXPECTED OUTPUT

list all no_inventori of extension

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.