• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

php中的分页跳转函数,点击时没反应,该怎么处理

php 搞代码 3年前 (2022-01-24) 19次浏览 已收录 0个评论

php中的分页跳转函@本文来*源gaodai#ma#com搞*!代#%^码$网*数,点击时没反应
显示页面:

Information
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
<script type=”text/javascript”>
var xmlHttp ;
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp=new ActiveXObject(“Microsoft.XMLHTTP”) ;
}else if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest() ;
}
}
function viewpage(p){
var formdata=”page”+p ;
createXMLHttpRequest() ;
xmlHttp.onreadystatechange=callback ;
xmlHttp.open(“POST” , “recordsend.php” , true) ;
xmlHttp.setRequestHeader(“Content-Type” , “application/x-www-form-urlencoded”) ;
xmlHttp.send(formdata) ;
//return false ; //why?
}
function callback(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
document.getElementById(“content”).innerHTML=xmlHttp.responseText ;
}
}
}
</script>

<?php
session_start() ;
error_reporting(E_ALL & ~E_NOTICE);
?>
<body onl oad=”viewpage(2)”>

<?php
echo $_SESSION[“name”].”的聊天记录” ;
?>

数据发送页面:recordsend.php
<?php
session_start() ;
error_reporting(E_ALL & ~E_NOTICE);
header(“Content-Type:text/html ; charset=gb2312”) ;
$pagesize=5 ;
$id=$_SESSION[“id”] ;
include_once(“conn.php”) ;
$result=mysql_query(“select count(DISTINCT id) from chatcontent where user_id=’$id'”) ;
$myrow=mysql_fetch_array($result) ;
$numrows=$myrow[0] ;
//获取总页数
if($numrows<$pagesize){
$pages=1 ;
}
if($numrows%$pagesize){
$pages=intval($numrows/$pagesize)+1 ;
}
else{
$pages=intval($numrows/$pagesize) ;
}
//获取页数
if(isset($_POST[“page”])){
$page=intval($_POST[“page”]) ;
}
else{
$page=1 ;
}
$first=1 ;
$sql=”select * from chatcontent where user_id=”.$id.” order by id desc limit “.($pagesize*($page-1)).” , $pagesize” ;
$zwt=mysql_query($sql) ;
$num=mysql_num_rows($zwt) ;
while($row=mysql_fetch_array($zwt , MYSQL_NUM)){
$content[]=$row[2] ;
$date[]=$row[3] ;
}
echo “

” ;
echo “

” ;
for($a=0 ; $a<$num ; $a++){
echo “

” ;
echo “

” ;
echo “

” ;
echo “

” ;
}
echo “

聊天内容 聊天时间
“.$content[$a].” “.$date[$a].”

” ;
echo “

” ;
echo “

” ;
echo “第”.$page.”页/总共”.$pages.”页 | 总”.$numrows.”条记录 ” ;
if($page==1){
echo “首页|上一页|” ;
}
else{
echo “首页|” ;
echo “上一页|” ;
}
if($page==$pages){
echo “下一页|尾页” ;
}
else{
echo “下一页|” ;
echo “尾页” ;


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:php中的分页跳转函数,点击时没反应,该怎么处理

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址