複製程式碼 程式碼如下:
投票結果
複製程式碼
程式碼如下:
$link = mysql_connect('localhost', 'root', '') or die(mysql_error() );
mysql_select_db('vote', $link) or die(mysql_error());
mysql_query("set names utf8");
$num = 3;
$url = "page .php";
$con = "
";
$page = (isset($_REQUEST['page'])) ? $_REQUEST['page'] : 1;
$offset = ($page - 1) * $num;
$result = mysql_query("SELECT COUNT(*) FROM client");
$total = mysql_fetch_row($result); $total = $total [0]; $pagenum = ceil($total / $num);
$page = min($pagenum, $page); //取得首頁$prepg = $page - 1; / /上一頁
if ($prepg $prepg = 1; $nextpg = ($page == $pagenum ? 1 : $page + 1); //下一頁//如果只有一頁則跳出函數: if ($pagenum return false; $sql = "SELECT `name`,`content` FROM `client` LIMIT " . $offset . "," . $num; $res = mysql_query($sql); while ($content = mysql_fetch_row($res)) { $con .= "- $content[0]: $content[1]
"; } $con .= "
"; $con .=
PAGE; echo $con; ?>
以上就介紹了air jordan xx8 ajax實現無刷新分頁php,包括了air jordan xx8方面的內容,希望對PHP教程有興趣的朋友有所幫助。