Single database field multi-column display in PHP
This article mainly introduces a single database field in PHP display of multiple columns, branch display skills, can also be called one-page pagination, horizontal output, the need for friends can refer to the next
Today in the project, encountered a problem is to read from the database of the same field branch display, that is, each row shows 12 columns, according to the total number of records to control the number of loops. If the multi-field is very good implementation, a loop, if it is a field loop so it is more troublesome, need to use multiple loops and incremental variables, there are many online phper encounter similar problems, today's small series to share their solutions.
For the same field loop multiline and control column display number, the principle is to first use limit to read out the first loop, and then take the first loop read the number of records and the number of columns to display each row. The following code is directly attached:
First Loop code:
"/>
after the Loop code:
"/>
Of course, there are more direct methods, that is, the first cycle of multiple loops, only need to change the limit of the first parameter. Hope for beginners phper helpful.
http://www.bkjia.com/PHPjc/852821.html www.bkjia.com true http://www.bkjia.com/PHPjc/852821.html techarticle Single database field multi-column display in PHP this article mainly introduces the single database field in PHP, multi-column display, branch breakdown display skills, also known as one-piece page pagination, horizontal output, need ...