Copy the code The code is as follows:
Poll results Copy code The code is as follows:
$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); //Get the home page
$prepg = $page - 1; //Previous page
if ($prepg <= 1)
$prepg = 1;
$nextpg = ( $page == $pagenum ? 1 : $page + 1); //Next page
//If there is only one page, jump out of the function:
if ($pagenum <= 1)
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
PAGE;
echo $con;
?>
The above introduces air jordan xx8 ajax to implement non-refresh paging in php, including the content of air jordan xx8. I hope it will be helpful to friends who are interested in PHP tutorials.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn