PHP and MySQL related issues with paging

Source: Internet
Author: User
Tags php and mysql
PHP and MySQL questions about paging
Use PHP to extract the information from MySQL and show him the page
Code:











































$mylink =mysql_connect ("localhost", "root", "998121021");mysql_select_db ("Liuyan", $mylink);$sql = "SELECT * from Data order by time";$result =mysql_query ($sql);$message _count=mysql_num_rows ($result);echo $message _count;$i = $message _count-1;$page _size=2;$page _count=ceil ($message _count/$page _size);echo $page _count;if ($page <1) $page = 1;if ($page > $page _count) $page = $page _count;$offset = ($page-1) * $page _size;$sql 1= "SELECT * from the data order by time limit $offset, $page _size";$result 1=mysql_query ($sql 1);while ($myarray =mysql_fetch_array ($result 1)) {Extract ($myarray);Echo ' '; Echo ' '; Echo ' '; Echo ' '; Echo ' '; Echo ' '; Echo ' '; Echo ' '; Echo ' '; Echo ' '; Echo ' '; Echo ' '; Echo ' '; $i--;}? >
'. ($message _count-$i). " Building ".'." User name: ". $name. ''.''. $email. '
'. $time. '
'. $words. '
'.' '.'


$pre _page= $page-1;
$next _page= $page +1;
Echo $page;
$PATH _info=pathinfo ("http://localhost:250/myphp Programming/Message Board page Display/message board pagination display. php");
if ($page ==1)
{
echo "first page previous page". " ";
}
Else
{
echo "First page";
echo "";
echo "Prev";
}
echo "";
if ($page = = $page _count)
{
echo "Next page last page";
}
Else
{
echo "Next page";
echo "";
echo "last Page";
echo $page _count;
}

?>

The pagination display part of the code is wrong, the path_info () function in the book is wrong, I do not know how to use, "http://localhost:250/myphp Programming/Message Board page Display/message board pagination display." PHP is my file path. In the "next page" "Last Page", "first page" "Previous page" link is how to write?

------Solution--------------------
$page =$_get[' page '? $_get[' page ': 1; Add this sentence.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.