您好我想使用表格显示一些搜索结果。在我的代码中,基本详细信息显示在一个表格中,如果我们想查看更多详细信息,您必须单击查看更多选项。隐藏详细信息也显示在单独的表格中。但是我的代码有问题。如果我的数据库中有多个搜索结果,则有关第一人称的详细信息将根据需要显示。这意味着我想查看更多详细信息,我想单击查看更多,然后它会滑下隐藏表。但搜索结果的其余部分也显示隐藏的表格。而且,如果我单击其余部分的查看更多选项,它会再次滑下第一人称表的隐藏表。在这里,我附上了我的代码。你能帮我解决这个问题吗?
<body>
<div class="container"> <!-- container -->
<div class="row" id="main-content">
<div class="span8">
<div class="well"> <!-- -start of well class -->
<?php
dbConnect();
$district = $_POST['district'];
$category = $_POST['catID'];
$subject = $_POST['subID'];
//get the category name
$get_cat_name = mysql_query("SELECT catName FROM tutor_category WHERE catID='{$category}' ");
while($row = mysql_fetch_assoc($get_cat_name ))
{
$cat_name = $row['catName'];
}
//get the subject name
$get_sub_name = mysql_query(" SELECT subName FROM tutor_subjects WHERE catID='{$category}' AND subID='{$subject}'");
while($row = mysql_fetch_assoc($get_sub_name ))
{
$sub_name = $row['subName'];
}
?>
<!-- ****************** Heading Table *******************-->
<table class="table table-bordered">
<tr>
<th> <?php echo $district." District - ". $cat_name ." - ". $sub_name ?> </th>
</tr>
</table>
<!-- ****************** end of heading table *******************-->
<?php
//get tutor IDs
$get_tutor_id = mysql_query(" SELECT DISTINCT tutorID FROM tutor_register_subjects WHERE district='{$district}' AND catID='{$category}' AND subID='{$subject}' ");
while($row = mysql_fetch_assoc($get_tutor_id)) // first
{
$tutor_id = $row['tutorID'];
$query = mysql_query(" SELECT * FROM tutor WHERE tutorID='{$tutor_id}' ");
while($row = mysql_fetch_assoc($query))
{ // second
$fname = $row['firstName'];
$lname = $row['lastName'];
$nic = $row['nic'];
$gender = $row['gender'];
$education = $row['education'];
$address = $row['address'];
$profession= $row['profession'];
$email = $row['email'];
$cnum = $row['contactNum'];
$avatar = $row['avatar'];
} // second
?>
<div class="control-group">
<!-- basic details -->
<table class="table table-bordered">
<tr>
<td width="120" rowspan="4"><?php echo "<img src='uploads/".$avatar."' height='120' width='100'>"?></td>
<th width="120">Name</th>
<td><?php echo $fname." ". $lname?></td>
</tr>
<tr>
<th>NIC</th>
<td><?php echo $nic ?></td>
</tr>
<tr>
<th>Gender</th>
<td><?php echo $gender ?></td>
</tr>
<tr>
<td colspan="2"><a class="more">View More</a> <a class="less">View Less</a></td>
</tr>
</table>
</div>
<!-- end of basic details -->
<!-- more details-->
<div class="control-group" id="more">
<table class="table table-bordered">
<tr>
<th>Contact Number</th>
<td><?php echo $cnum ?></td>
</tr>
<tr>
<th>Email</th>
<td><?php echo $email ?></td>
</tr>
<tr>
<th>Address</th>
<td><?php echo $address ?></td>
</tr>
<tr>
<th>Education</th>
<td><?php echo $education ?></td>
</tr>
<tr>
<th>Work Place</th>
<td><?php echo $profession ?></td>
</tr>
</table>
</div>
<!-- end of more details-->
<legend></legend>
<?php
} // first
?>
</div> <!-- -start of well class -->
</div> <!-- end span12 class -->
</div> <!-- end of row class -->
</div> <!-- container -->
<!-- view more script-->
<script src="../js/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#more").hide();
$(".less").click(function(){
$("#more").slideUp(1000);
});
$(".more").click(function(){
$("#more").slideDown(1000);
});
});
</script>
</body>