PHP_MySQL data paging
PHP_MySQL data paging
NamePrice"; While ($ rs = mysql_fetch_object ($ result) {echo"". $ Rs-> name ."". $ Rs-> price ."";} Echo""; $ Count = mysql_query (" select name from product "); # get the total number of records $ num = mysql_num_rows ($ count)/$ col; # calculate the number of pages $ num = ceil ($ num); # Use the unconditional fractional carry to determine the total number of pages mysql_close (); if ($ page = 1) {echo 'previous page ';} else {echo "previous page";} echo "no ". $ page. "page"; if ($ page = $ num) {echo 'next page
';} Else {echo "Next page
";}If ($ page = 1) {}else {echo" first page <";}for ($ I =-2; $ I <= 2; $ I ++) {if ($ page + $ I)> $ num | ($ page + $ I) <1) {} else {echo "". ($ page + $ I ). "" ;}}if ($ page ==$ num) {} else {echo ">>> last page
";}?>
The above is the content of PHP_MySQL data paging. For more information, see PHP Chinese network (www.php1.cn )!