PHP分页问题.代码很长,工作量也多了点,希望能给出导航栏的代码.
<?$connection=openconnection();$query="select*fromemailwhereTO_IDLIKE'GUESTBOOK_%'ord...
<?
$connection=openconnection();
$query="select * from email where TO_ID LIKE 'GUESTBOOK_%' order by SEND_TIME desc";
$cursor=exequery($connection,$query);
$EMAIL_COUNT=0;
while($ROW=mysql_fetch_array($cursor))
{
$EMAIL_COUNT=$ROW[0];
}
if($EMAIL_COUNT==0)
$PER_PAGE = 2;
$PAGES = 5;
$PAGE_COUNT = ceil( $EMAIL_COUNT / $PER_PAGE );
if ( $CUR_PAGE <= 0 || $CUR_PAGE == "" )
{
$CUR_PAGE = 1;
}
if ( $PAGE_COUNT < $CUR_PAGE )
{
$CUR_PAGE = $PAGE_COUNT;
}
$connection=openconnection();
$query="select * from email where TO_ID LIKE 'GUESTBOOK_%' order by SEND_TIME DESC";
$cursor=exequery($connection,$query);
$COUNT=0;
while($ROW=mysql_fetch_array($cursor))
{
++$COUNT;
if ( $COUNT < $CUR_PAGE * $PER_PAGE - $PER_PAGE + 1 )
{
break;
}
else if ( $CUR_PAGE * $PER_PAGE < $COUNT )
{
break;
}
$EMAIL_ID=$ROW['EMAIL_ID'];
$SUBJECT=$ROW['SUBJECT'];
$CONTENT=$ROW['CONTENT'];
$TO_ID=$ROW['TO_ID'];
$SEND_TIME=$ROW['SEND_TIME'];
$SUBJECT1=strtok($SUBJECT,"Re:");
$query1="select * from email where FROM_ID='$TO_ID'and SUBJECT='$SUBJECT1' order by SEND_TIME DESC";
$cursor1=exequery($connection,$query1);
if($ROW1=mysql_fetch_array($cursor1))
$FROM_ID=$ROW1['FROM_ID'];
$CONTENT1=$ROW1['CONTENT'];
$SEND_TIME1=$ROW1['SEND_TIME'];
$FROM_ID1=strtok($FROM_ID,"GUESTBOOK_");
?>这里是一个table,显示上述中的FROM_ID1 CONTENT SEND_TIME CONTENT1 SEND_TIME1等<?
}
}
?>
PS:我自己写出来导航栏代码了,也实现跳页的功能,只是分页显示的功能不能实现,跳到的都是没有显示出应该显示的信息.如有需要,可以提供完整的代码,可以在原有基础上改写.不胜感谢.答对加分. 展开
$connection=openconnection();
$query="select * from email where TO_ID LIKE 'GUESTBOOK_%' order by SEND_TIME desc";
$cursor=exequery($connection,$query);
$EMAIL_COUNT=0;
while($ROW=mysql_fetch_array($cursor))
{
$EMAIL_COUNT=$ROW[0];
}
if($EMAIL_COUNT==0)
$PER_PAGE = 2;
$PAGES = 5;
$PAGE_COUNT = ceil( $EMAIL_COUNT / $PER_PAGE );
if ( $CUR_PAGE <= 0 || $CUR_PAGE == "" )
{
$CUR_PAGE = 1;
}
if ( $PAGE_COUNT < $CUR_PAGE )
{
$CUR_PAGE = $PAGE_COUNT;
}
$connection=openconnection();
$query="select * from email where TO_ID LIKE 'GUESTBOOK_%' order by SEND_TIME DESC";
$cursor=exequery($connection,$query);
$COUNT=0;
while($ROW=mysql_fetch_array($cursor))
{
++$COUNT;
if ( $COUNT < $CUR_PAGE * $PER_PAGE - $PER_PAGE + 1 )
{
break;
}
else if ( $CUR_PAGE * $PER_PAGE < $COUNT )
{
break;
}
$EMAIL_ID=$ROW['EMAIL_ID'];
$SUBJECT=$ROW['SUBJECT'];
$CONTENT=$ROW['CONTENT'];
$TO_ID=$ROW['TO_ID'];
$SEND_TIME=$ROW['SEND_TIME'];
$SUBJECT1=strtok($SUBJECT,"Re:");
$query1="select * from email where FROM_ID='$TO_ID'and SUBJECT='$SUBJECT1' order by SEND_TIME DESC";
$cursor1=exequery($connection,$query1);
if($ROW1=mysql_fetch_array($cursor1))
$FROM_ID=$ROW1['FROM_ID'];
$CONTENT1=$ROW1['CONTENT'];
$SEND_TIME1=$ROW1['SEND_TIME'];
$FROM_ID1=strtok($FROM_ID,"GUESTBOOK_");
?>这里是一个table,显示上述中的FROM_ID1 CONTENT SEND_TIME CONTENT1 SEND_TIME1等<?
}
}
?>
PS:我自己写出来导航栏代码了,也实现跳页的功能,只是分页显示的功能不能实现,跳到的都是没有显示出应该显示的信息.如有需要,可以提供完整的代码,可以在原有基础上改写.不胜感谢.答对加分. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询