Please help me check the problem.

Source: Internet
Author: User
Please check it out for me. what is wrong with my search page? Submitted. the number and page number obtained are correct. when you press the next page, all the information in the database is displayed on the page. help me modify it. thank you. & lt ;? Php & nbsp; $ city $ _ GET [city]; & nbsp; $ quxian $ _ GET [quxian]; & nbsp; $ lx $ _ GET [lx]; could you please check my search page?
// Submit it. the obtained number and page number are correct. when you press the next page, all the information in the database is displayed on the page. help me modify it. 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 method '){
$ 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;

// Determine 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]. Ignore ."
  • ";
    Echo"

    "."

    ";
    }
    }
    ?>
    $ Page_len = ($ page_len % 2 )? $ Page_len: $ pagelen + 1; // Number of page numbers
    $ Pageoffset = ($ page_len-1)/2; // page number offset between left and right

    $ Key ='

    ';
    // $ Key. = "$ page/$ pages"; // page
    If ($ page! = 1 ){
    // $ Key. = "page 1"; // page 1
    $ Key. =" <上一页"; 上一页
    } Else {
    // $ Key. = "page 1"; // page 1
    // $ 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 maximum page number
    If ($ page + $ pageoffset >=$ pages + 1 ){
    $ Init = $ pages-$ page_len + 1;
    } Else {
    // Calculation when both the left and right offsets exist
    $ Init = $ page-$ pageoffset;
    $ Max_p = $ page + $ pageoffset;

    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.