Please help me to check one, little brother my search page where out of the question

Source: Internet
Author: User
Please help me to check, my search page where the problem?
Submitted to, get to the number of bars and pages are correct, press the next page, turned into a database of all the information page, help me change, thank you


$city =$_get[city];
$quxian = $_get[quxian];
$LX = $_GET[LX];
$gongqiu = $_get[gongqiu];
$SPMJ = $_GET[SPMJ];
$cont = $_get[cont];

$sql = ' SELECT * from new ';

if ($spmj! = ' Shop area ') {
$sql. = "where MJ $SPMJ";
}
if ($city! = ") {
$sql. = (Preg_match ('/where/', $sql)? ' and ': ' Where '). ' City like '% '. $city. ' %" ';
}
if ($quxian! = ") {
$sql. = (Preg_match ('/where/', $sql)? ' and ': ' Where '). ' Quxian like '% '. $quxian. ' %" ';
}
if ($lx! = ' Shop type ') {
$sql. = (Preg_match ('/where/', $sql)? ' and ': ' Where '). ' lx like '% '. $lx. ' %" ';
}

if ($gongqiu! = ' supply and Demand mode ') {
$sql. = (Preg_match ('/where/', $sql)? ' and ': ' Where '). ' Gongqiu like '% '. $gongqiu. ' %" ';
}

if ($cont! = ") {
$sql. = (Preg_match ('/where/', $sql)? ' and ': ' Where '). ' cont like '% '. $cont. '% ';
}

$result = mysql_query ($sql);
echo $count = mysql_num_rows ($result);
$Page _size=3;
$page _count = ceil ($count/$Page _size);
if (Empty ($_get[' page ') | | $_get[' page ']<0) {
$page = 1;
}else {
$page =$_get[' page ';
}

$page _len= 3;
$max _p= $page _count;
$pages = $page _count;

Judging the current page number
$offset = $Page _size* ($page-1);
echo $result = $sql. " Limit $offset, $Page _size ";
$result =mysql_query ($result);
while ($row =mysql_fetch_array ($result)) {
if ($result) {
echo "";
echo "";
echo "";
echo "";
echo "";
echo "";
echo $row [title]. "";
Echo '. ' ". $row [NS]."
";
Echo substr ($row [cont],0,200).
"." ". $row [Quxian]."". $row [lx]. ' '. $row [TIME];
echo "";
echo "";
echo "
  • ". $row [Q]. $row [DW]."
  • ";
    echo "
  • ". $row [Mj].┫.]
  • ";
    echo "". "";
    }
    }
    ?>
    $page _len = ($page _len%2)? $page _len: $pagelen +1;//page number
    $pageoffset = ($page _len-1)/2;//page number offset

    $key = ";
    $key. = " $page/$pages"; Page, total pages
    if ($page!=1) {
    $key. = "First page"; First page
    $key. = " <上一页"; 上一页
    <上一页";>
    }else {
    $key. = "First page";//First page
    $key. = "Previous page"; Previous page
    }

    if ($pages > $page _len) {
    If the current page is less than or equal to the left offset
    if ($page <= $pageoffset) {
    $max _p = $page _len;
    }else{//If the current page is greater than the left offset
    If the right offset of the current page number exceeds the Max page count
    if ($page + $pageoffset >= $pages + 1) {
    $init = $pages-$page _len+1;
    }else{
    Calculations when left and right offsets are present
    $init = $page-$pageoffset;
    $max _p = $page + $pageoffset;
  • Related Article

    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.