Php paging 1

Source: Internet
Author: User

<? Php
/**
* User List
* Kcj
* 2011/8/20
**/
Include "../conn. php ";
$ SQL = "select * from user ";
$ Rst = mysql_query ($ SQL );
$ Totalnum = mysql_num_rows ($ rst );
$ Pagesize = 2;
$ Page = $ _ GET ['page'];
If ($ page = ''){
$ Page = 1;
}
$ Pagecount = ceil ($ totalnum/$ pagesize );
$ Bingage = ($ page-1) * $ pagesize;
?>
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> untitled document </title>
<Meta name = "Author" content = "kcj"/>
<Meta name = "Keywords" content = "php, lampbrother"/>
<Link rel = "stylesheet" type = "text/css" href = "style/lampcms.css">
<Script src = "javascript/common. js"> </script>
</Head>
<Body>
<Div id = "main">
Background Management-> User List
<Form method = "post" action = "">
<Div class = "msg-box">
<Ul class = "viewmess">
<Li class = "dark-row">
<Span class = "list_width width_font"> User Name </span>
<Span class = "list_width width_font" style = "width: 200px"> remark name </span>
<Span class = "list_width width_font"> registration time </span>
<Span class = "list_width width_font"> operation </span>
</Li>

<Li class = "light-row" style = "padding-top: 2px; padding-bottom: 2px">
<? Php
$ SQL = "select * from user order by id asc limit $ bingage, $ pagesize ";
$ Rst = mysql_query ($ SQL );
While ($ row = mysql_fetch_array ($ rst )){
?>
<Span class = "list_width"> <? Php echo $ row ['username'];?> </Span>
 
<Span class = "list_width" style = "width: 200px"> <? Php echo $ row ['rname'];?> </Span>
<Span class = "list_width"> <? Php echo $ row ['ctime'];?> </Span>
 
<Span class = "list_width" style = "width: 160px;">

[<A href = "main. php? Action = addUser & edit = mod & id = <{$ users [doc]. id}> "> modify </a>]
<? Php if ($ row ['id']! = 1) {?>
[<A onclick = "return confirm ('Are you sure you want to delete the user <{$ users [doc]. userName}>? ') "Href =" main. php? Action = editUser & page = <{$ pageInfo. current_page}> & id = <{$ users [doc]. id}> & edit = del "> Delete </a>]
<? Php }?>
</Span>
<?
}
?>
</Li>
 
 
<Li class = "dark-row">
<Span class = "col_width" style = "margin-left: 15px; width: 240px;">
Total <? Php echo $ totalnum;?> Total <? Php echo $ pagecount;?> Page. <? Php echo $ pagesize;?> Entries
<A href = "<? Php echo $ _ SERVER ['php _ SELF ']?>? Page = 1 "> homepage </a>
<? Php
For ($ I = 1; $ I <= $ pagecount; $ I ++ ){
Echo "<a href =". $ _ SERVER ['php _ SELF ']. "? Page = $ I "."> [". $ I."] </a> ";
}

?>
<A href = "<? Php echo $ _ SERVER ['php _ SELF ']. "? Page = ". $ pagecount;?> "> Last page </a>
</Span>
</Li>
</Ul>
</Div>
</Form>
</Div>
</Body>
</Html>

From chaojie2009

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.