It is supposed to list out all records of roomID 57, but the record is duplicate.

<?php 
require '../../source/authentication.inc';
session_start();
sessionAuthenticate();

require_once('../../config/conn.php');
?>
<?php require_once('../../config/conn.php'); 
$roomID=$_GET['roomID'];
$sql="SELECT * FROM roomBooking where roomID = '$roomID'";
$rs=mysql_query($sql,$conn);
$row_rs = mysql_fetch_assoc($rs);
$count=mysql_num_rows($rs);
$roomID=$row_rs['roomID'];
$bookingDate=$row_rs['bookingDate'];
$startTime=$row_rs['startTime'];
$endTime=$row_rs['endTime'];
$numberOfPeople=$row_rs['numberOfPeople'];
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>職員控制中心</title>
<link href="../../css/master.css" rel="stylesheet" type="text/css" media="screen">

</head>

<body>
    <header>
        <h1>職員控制中心</h1>
    </header>
    <nav>
     <ul>
     <li><a href="../s_home.php">會員管理</a></li>
     <li><a href="../postManagement.php">文章管理</a></li>
     <li><a href="../newMen.php">消息管理</a></li>
     <li><a href="../activityManagement.php">活動管理</a></li>
     <li><a href="../fileManagement.php">檔案管理</a></li>
     <li class="selected"><a href="../roomManagement.php">房間資源</a></li>  
     <li><a href="../fileManagement.php">圖片庫管理</a></li>  
     </ul>
    </nav>
    <div id="content">
    <div id="mainContent">
    <section id="intro">
           <header>
        <h2>職員控制中心</h2>
      </header>
    </section>
    <section>
    <article class="blogPost">
     <header>
     <?php do { ?>
    <h2>房間: <?php echo $roomID ?></h2>
    </header>
    <p>日期: <?php echo $bookingDate ?></p>
    <p>開始時間: <?php echo $startTime ?></p>
    <p>結束時間: <?php echo $endTime ?></p>
    <p>使用房間人數: <?php echo $numberOfPeople ?></p>
    <p><?php //printf('<a href="del_room.php?roomID=%s">取消預約</a>',$row_rs['roomID']);
    ?></p>
    <p><?php //printf('<a href="../roomDetail.php?roomID=%s">修改</a>',$row_rs['roomID']);
    ?></p>
    <?php }while ($row_rs = mysql_fetch_assoc($rs));?>
    </article>
    </section>
    </div>
    <aside>
    <section>
    <header>
            <h3>歡迎 : <?php echo $_SESSION["loginUsername"]; ?></h3>
        </header>
    <form name="logoutForm" method="post" action="../../source/logout.php">
    <input type="submit" name="logout" id="logput" value="Logout">
    </form>
    </section>
    <section>  
    <header>
    <h3>房間管理</h3>
    </header>
    <ul>
    <li><a href="../roomManagement.php">建立房間</a></li>  
    <li><a href="../StaffBooking.php">預約房間</a></li>
    <li><a href="../room.php">修改,取消已訂房間</a></li>    
    </ul>
    </section>        
    </aside>
    </div>
 <footer>
    <p>Copyright © 2010-2011 長洲浸信會,Cheung Chau Baptist Church 版權所有</p>
  </footer>      
</body>
</html>

Recommended Answers

All 3 Replies

roomID 57 is twice in the table, for different roomBookingID.

Perhaps the error lies in your roomDetail.php, you pass it only the roomID, so it does not know which roomBookingID you mean.

If that's not it, try to explain a little better (I can't read your pictures), and please use code tags.

roomID 57 is twice in the table, for different roomBookingID.

Perhaps the error lies in your roomDetail.php, you pass it only the roomID, so it does not know which roomBookingID you mean.

If that's not it, try to explain a little better (I can't read your pictures), and please use code tags.

How to correct it?
Also, the roombookingID is not in sequential order after I deleted booking.

How to correct it ? Want me to guess... ? It all depends on what you want, and what you already have.

You can sort anyway you want.

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.