Multi-column display of single database fields in PHP (One-field pagination, horizontal output), Multi-column paging
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:
"/><?php echo $inf [' Ei_employeename ']?><?php}?>
after the Loop code:
"/><?php echo $inf [' Ei_employeename ']?><?php}?><?php}?>
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.
PHP database field is the date and time type, PHP paging display time is the same, too long, how to display only the date does not show the time
I recommend that you save the time () function to the second, the Data table field type int (10) can be, the output can be directly with the date (' y-m-d ', db[' time ') format output!
PHP output specified field segment contents in MySQL Database
Database Connection section omitted
$q = mysql_query ("Select User,tel from Darkit. Users limit ", $lnk);
while ($rs = Mysql_fetch_assoc ($q)) {
echo $rs [' User '], ': ', $rs [' Tel '], '
";
}
///////
http://www.bkjia.com/PHPjc/851339.html www.bkjia.com true http://www.bkjia.com/PHPjc/851339.html techarticle Single database field multi-column display in PHP (one field pagination, horizontal output), multi-column paging when doing the project today, there is a problem is to read out from the database of the same fields branch points ...