我想转换这个
mysql表:
title1 | title2 |type -------+--------+---- qwe1 | qwe2 | 3 asd1 | asd2 | 7
在PHP中的这个表
title | type ------+----- asd1 | 7 asd2 | 7 qwe1 | 3 qwe1 | 3
但我不知道如何正确地按第一列排序PHP表.
有任何想法吗?
提前致谢.
(这是我目前使用的代码)
$sql = "SELECT * FROM table ORDER BY title1,title2"; $pager = new PS_Pagination( $dbh,$sql,3,4,null );//pagination class $rs = $pager->paginate(); while ($row = $rs->fetch(PDO::FETCH_ASSOC)){ echo "<tr>"; echo "<td>{$row['title1']}</td>"; echo "<td>{$row['type']}</td>"; echo "</tr>"; echo "<tr>"; echo "<td>{$row['title2']}</td>"; echo "<td>{$row['type']}</td>"; echo "</tr>"; } echo "</table>";