PHP Paging code (complete PHP MySQL Classic page instances) (1/2)

Source: Internet
Author: User

HTML code

The code is as follows Copy Code

<table width= "100%" border= "0" valign= "Top" align= "center" cellpadding= "0" cellspacing= "0" >
<tr>
<TD valign= "Top" >

<table width= "border=" 0 "align=" center "cellpadding=" 0 "cellspacing=" 1 "bgcolor=" #cccccc "class=" All "id=" tr " >

          <tr
             <td align= "center" bgcolor= "#d4e6ec" >ID</TD>
             <td height= "align=" "left" bgcolor= "#d4e6ec" > title </td
            <td align= "left" bgcolor= "#d4e6ec" > Date </td>
          </tr> 
<?php Include_once ("page.php");? > 
<?php
$conn =mysql_connect ("localhost", "root", "") or Die (" Unable to connect to database tutorial: ". Mysql_error ());
$db =mysql_select_db ("dbtest") or Die ("Select Database error:". Mysql_error ());
mysql_query ("Set names gb2312");

$sql = "SELECT * FROM Test-id";
Genpage ($sql, 3); This refers to the first function, followed by a number that defines the number of records per page
$result =mysql_query ($sql) or Die ("Database operation error:". Mysql_error ());
while ($row =mysql_fetch_array ($result))
{
?>

<tr >
<TD width= "align=" "Center" bgcolor= "#ffffff" ><?php echo $row [' id ']?> </td>
<TD width= "383" height= "align=" "left" bgcolor= "#ffffff" ><?php echo $row [' title ']?></td>
<TD width= "162" align= "left" bgcolor= "#ffffff" ><?php echo $row [' editdate ']?></td>
</tr>

<?php
}
?>
<tr>
<TD height= colspan= "3" align= "center" bgcolor= "#d4e6ec" ><?php showpage ();//This refers to the second function?></td>
</tr>
</table>

Home 1 2 last page

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.