我的过滤系统有问题,我想过滤通知。过滤应该使用每个帖子具有的状态 ID,例如错误报告具有状态 ID nro。6.
这是我使用的 jQuery 脚本:
$(document).ready(function() {
$("#status_option").change(
function(){
var statusValue = $('#status_option option:selected').val();
if(statusValue == "1"){
<?php
$sql_status1="SELECT * FROM notice, user, status WHERE notice.userID = user.userID AND notice.statusID = status.statusID = '1' ORDER BY noticeID DESC";
$result_status1=mysql_query($sql_status1);
?>
}
else if(statusValue == "2"){
<?php
$sql_status2="SELECT * FROM notice, user, status WHERE notice.userID = user.userID AND notice.statusID = status.statusID AND status.statusID = '2' ORDER BY noticeID DESC";
$result_status2=mysql_query($sql_status2);
?>
}
else if(statusValue == "3"){
<?php
$sql_status3="SELECT * FROM notice, user, status WHERE notice.userID = user.userID AND notice.statusID = status.statusID AND status.statusID = '3' ORDER BY noticeID DESC";
$result_status3=mysql_query($sql_status3);
?>
}
else if(statusValue == "4"){
<?php
$sql_status4="SELECT * FROM notice, user, status WHERE notice.userID = user.userID AND notice.statusID = status.statusID AND status.statusID = '4' ORDER BY noticeID DESC";
$result_status4=mysql_query($sql_status4);
?>
}
else if(statusValue == "5"){
<?php
$sql_status5="SELECT * FROM notice, user, status WHERE notice.userID = user.userID AND notice.statusID = status.statusID AND status.statusID = '5' ORDER BY noticeID DESC";
$result_status5=mysql_query($sql_status5);
?>
}
else if(statusValue == "6"){
<?php
$sql_status6="SELECT * FROM notice, user, status WHERE notice.userID = user.userID AND notice.statusID = status.statusID AND status.statusID = '6' ORDER BY noticeID DESC";
$result_status6=mysql_query($sql_status6);
?>
}
else{
<?php
$sql_default="SELECT * FROM notice, user, status WHERE notice.userID = user.userID AND notice.statusID = status.statusID ORDER BY noticeID DESC";
$result_default=mysql_query($sql_default);
?>
}
}
);});
从下拉列表中选择状态:
<select id="status_valinta" style="width:210px" >
<option title="css/msdropdown_img/status_all.gif">All posts</option>
<option value="1" title=".../status1.gif">Notification</option>
<option value="2" title=".../status2.gif">Waiting for answer</option>
<option value="3" title=".../status3.gif">Guide</option>
<option value="4" title=".../status4.gif">Document</option>
<option value="5" title=".../status5.gif">Image</option>
<option value="6" title=".../status6.gif">Bug-report</option>
问题是当我从下拉列表中选择我想要的状态时,什么也没有发生。此外,该过滤系统应该通过将过滤后的信息动态地打开到同一页面来工作。
这是显示打印数据的地方:
<table width="100%" id="notices" class="ui-widget ui-widget-content">
<thead>
<tr class="ui-widget-header ">
<th>Subject</th>
<th>Sender</th>
<th>Comments</th>
<th>Timestamp</th>
</tr>
</thead>
<tbody>
<?php
while($rows=mysql_fetch_array($result)){ // Starting looping rows
?>
<tr style="background-color:<?php echo $rows['colorCode']; ?>">
<td>
<a class="opener_notice, load_data" href="notice_v2.php?id=<?php echo $rows['noticeID']; ?>">
<?php echo $rows['title']; ?>
</td>
<td><?php echo $rows['firstname']; ?> <?php echo $rows['lastname']; ?>
</td>
<td><?php echo $rows['commentID']; ?></td>
<td><?php echo date('d.m.Y, H:i:s', strtotime( $rows['sendTime'] )); ?>
</td>
</tr>
<?php
// Stopping the looping and closing the mysql connection
} mysql_close();
?>
</tbody>
</table>