Php + mysql site search + paging

Source: Internet
Author: User
Php + mysql intra-site search + paging. below is the intra-site search section (displayed), which cannot be divided by page, as my life forced me to complete this project to others while learning, and all the templates were not used, the following code could not be submitted by Baidu, so I 'd like to ask for help.
If (isset ($ _ POST ['search']) and $ _ POST ['search']! = Null ){
$ Result = mysql_query ("select * from tb_members where shopname like '%". $ _ POST ['search']. "% '");
$ Info = mysql_fetch_array ($ result); if ($ info> = 1 ){
While ($ info = mysql_fetch_array ($ result) {?>
">
}
} Else {
Echo "no content you want to find! ";
}
}
?>


Reply to discussion (solution)

Paging is a very basic part. I don't provide the solution code. I just found the php + mysql paging instance code on the disc on the book I bought a few years ago, I hope you can understand the usage of pagination.

 $ TotalPages) $ pageNum = $ totalPages; // set the starting line number $ startRow = ($ pageNum-1) * $ maxRows; // add the LIMIT clause $ SQL _limit = sprintf ("% s LIMIT % d, % d", $ SQL, $ startRow, $ maxRows) for the query statement ); // send the query statement $ rs = mysql_query ($ SQL _limit) or die (mysql_error (); // Obtain a row of records from the record set $ row = mysql_fetch_row ($ rs);?>
 Display records by page
 
  \ N "); $ colNum = mysql_num_fields ($ rsAll); for ($ I = 0; $ I <$ colNum; $ I ++) {$ meta = mysql_fetch_field ($ rsAll); printf ("
  \ N ", $ meta-> name);} print ("
   \ N "); do {print ("
   
    
\ N "); for ($ I = 0; $ I <$ maxRows; $ I ++) printf ("
    \ N ", $ row [$ I]); print ("
   \ N ") ;}while ($ row = mysql_fetch_row ($ rs);?>
  
Display records by page
% S
% S

I have a lot of pages. I can't use the search code above (the search code can be used), and my pages are available elsewhere.

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.