Help the Home (www.Bkjia.com) Tutorial PHP Instance code: AJAX page display data.
Files for debugging
The following is the referenced content:
Help the home to provide tutorials liehuo.net attention webmaster, building the Internet!
Data pagination Display
|
Another file that is called example8_7_1.php
The following is the referenced content: Header ("content-type:text/html;charset=gb2312"); $pagesize = 10; echo $_post[' page '; $db =mysql_connect ("localhost", "root", ""); Create a database connection mysql_query ("Set character set Utf-8"); mysql_select_db ("optics"); $result = mysql_query ("SELECT count (DISTINCT ArticleID) from product"); $myrow = Mysql_fetch_array ($result); $numrows = $myrow [0]; $pages =intval ($numrows/$pagesize); if ($numrows% $pagesize) $pages + +; if (Isset ($_post[' page ')) { $page =intval ($_post[' page '); } else{ Set as first page $page = 1; } $first = 1; $prev = $page-1; $next = $page +1; $last = $pages; Calculate record offset $offset = $pagesize * ($page-1); Reads the specified number of records
$result =mysql_query ("Select ' ID ', COUNT (*) from". GROUP by ' ID ' ORDER BY id desc limit $offset, $pagesize "); $result =mysql_query ("SELECT * from Product GROUP by ' ArticleID ' ORDER by ArticleID desc limit $offset, $pagesize"); $num = @mysql_num_rows ($result);
while ($row = @mysql_fetch_array ($result, mysql_num)) { $hotelname [] = $row [0]; $name []= $row [1]; $author []= $row [2]; $publisher []= $row [3]; $ISBN []= $row [4]; $type []= $row [5]; $smallpic []= $row [6]; $countpeople [] = $row [1]; } echo "
\ n "; echo "
\ n"; echo "
| ID Number |
name |
author |
Publishing House |
ISBN number |
type |
Price | "; for ($a =0; $a < $num; $a + +) {echo "
\ n "; echo "
| ". $hotelname [$a]." | "; echo "
". $name [$a]." | "; echo "
". $author [$a]." | "; echo "
". $publisher [$a]." | "; echo "
". $ISBN [$a]." | "; echo "
". $type [$a]." | "; echo "
| "; echo "
"; } echo "
\ n "; echo "
echo "Border=0>"; echo " |
"; echo ""; echo "Section ". $page." Page/Total ". $pages." Page | Total ". $numrows." Bar | "; if ($page >1) echo "Home |"; if ($page >1) echo "prev |"; if ($page < $pages) echo "next page |"; if ($page < $pages) echo "Last"; echo "Go to PagePage"; echo " |
";
?>
http://www.bkjia.com/PHPjc/364312.html www.bkjia.com true http://www.bkjia.com/PHPjc/364312.html techarticle Fire Net (liehuo.net) tutorial PHP instance code: AJAX Display data on a page. Debugging files The following is a reference to the content: HTML Head title Fire Network provides tutorials liehuo.net attention webmaster, ...