KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to convert this MySQL table: title1 | title2 |type -------+--------+---- qwe1 | qwe2 | 3 asd1 | asd2 | 7 to this table in PHP title | type ------+----- asd1 | 7 asd2 | 7 qwe1 | 3 qwe1 | 3 But I don't know how to order the PHP table by the first column correctly. (This is the code I am currently using) $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>";
Tags (comma-separated)
Save Edits
Cancel