这是我的整个页面代码。我的页面名称是manage-video2.php 在此代码中,如何通过我的网页中的select语句显示数据库中的记录。请任何人可以帮助我找出此代码中的错误并修复该错误。我很满意你。
<?php
include('config.php');
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script>
$("#sel1").change(function(){
$.get("manage-video2.php?value="+$(this).val(), function(data, status){
$("#resultdiv").html(data);
});
});
</script>
</head>
<body>
<div class="container pad20">
<div class="row">
<div class="col-md-12 col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">Manage Videos
<div class="form-group">
<label for="sel1">Select list:</label>
<select class="form-control" id="sel1" name="sel1" data-style="btn-primary">
<option value="1">25 Records</option>
<option value="2">50 Records</option>
<option value="3">75 Records</option>
<option value="4">More than 100</option>
</select>
</div>
</div>
<div id="resultdiv">
<form method="POST" action="processor.php">
<table id="table1" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr><th>Video Name</th></tr>
</thead>
<?php
$access = $_SESSION['login'];
if($access == "white"){
if(isset($_GET['value'])){
$sql = "SELECT * FROM videos ORDER BY id DESC LIMIT ".$_GET['value'];
else{
$sql = "SELECT * FROM videos ORDER BY id DESC";}
$query = $conn->query($sql);
$i=1;
while ($row = $query->fetch(PDO::FETCH_ASSOC)){
$video_name = $row['video_name'];
echo "
<tbody>
<tr><td id='test10' class='text-center'><b>$video_name</b></td></tr>
</tbody>";
} $i++;
}
else {
header ("location:index.php");
}
?>
</table>
<!-- End data table -->
</form>
</div>
</div>
</div>
</div><!-- /.container -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
</body>
</html>