我现在正在Dropdownlist分页中工作。但问题是我不知道下一步我要做什么。
这是脚本。下拉列表值是正确的,但我不知道如何完成此脚本。我需要的是当我选择分页下拉列表时,它会显示基于itemperpage的记录。但是这个脚本无效。
$('#pageNo').on('change', function(){
var loadPage = $('#pageNo').val();
// Do your page submit to load another page
});
get.php
<?php
$mysqli = new mysqli("localhost", "root", "", "app");
$id = $mysqli->real_escape_string($_GET["q"]);//used for Dynamic Dropdown
$id2 = $mysqli->real_escape_string($_GET["id"]); // used for PHP pagination
$sql = $mysqli->query("SELECT * FROM app ORDER BY id ASC");
$nr = mysqli_num_rows($sql);
$itemsPerPage = 100;
$page_count = ($nr / $itemsPerPage) + 1;
echo"<select id='pageNo'>";
for($y=1; $y < $page_count; $y++) {
echo "<option value='".$y."'>".$y."</option>";
}
echo'</select>';
?>
Select.php
<script>
function showUser(str,ids) {
var $txtHint = $('#txtHint');
if (str=="" || ids=="") {
$txtHint.html('');
return;
}
$txtHint.load('get.php?q='+str+'&id='+ids)
}
</script>
<body onload=showUser(str="ALL")>
<select name="drop_1" id="drop_1" onchange="showUser(this.value)" style="overflow:scroll;width:100px;">
<option value="ALL" selected='ALL'>ALL</option>
<?php getTierOne(); ?>
</select>
<div id="txtHint"></div>
答案 0 :(得分:0)
在你的SQL中可能更容易做到
$sql = $mysqli->query("SELECT * FROM app ORDER BY id ASC LIMIT ".$pagenum*100.",100");