I would like to ask about the related fields of multi-table in PHP and how to write SQL statements for paging processing.

Source: Internet
Author: User
I have four tables for writing SQL statements related to the multi-table link in PHP and paging processing, tb_bookinfo. Tb_booktype. Tb_bookcase. Tb_publishing. There are correlated fields in these tables. Below is an SQL statement without paging. the output is normal in do... while. The problem is that the data is getting bigger and bigger. now I want to add the paging function. The code has not been successfully modified. please ask PHP about the related fields of the multi-table link in PHP and write SQL statements for paging processing.
I have four tables, tb_bookinfo. Tb_booktype. Tb_bookcase. Tb_publishing. There are correlated fields in these tables. Below is an SQL statement without paging. the output is normal in do... while. The problem is that the data is getting bigger and bigger. now I want to add the paging function. The code has not been successfully modified. please help me with the PHP code. (do not copy the paging code online. please modify the code based on my SQL statement to enable paging) the appendix requires "N records in total, N records are displayed on each page. the current page is N, the first page, the previous page, the next page, and the last page ". Thank you first.
$ Query = mysql_query ("select B. *, c. name as bookcasename, p. pubname, t. typename from tb_bookinfo B left join tb_bookcase c on B. bookcase = c. id join tb_publishing p on B. ISBN = p. ISBN join tb_booktype t on B. typeid = t. id ");

------ Solution --------------------
You can add the limit parameter to implement paging.

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.