Showing Mysql table data in html form with php -
i'm showing data mysql table php inside html table, need 2 more things accomplish table:
1- how alternate colors table rows use 4 different css classes, using class='success' have 3 more want use , each 1 should apply each table row, how it? simple example loop or something?
2- data showing oldest record in table latest one, , want show reverse, last record shows first in html table.
my code table:
<?php echo "<table class='table'> <thead> <tr> <th>order#</th> <th>name</th> <th>total</th> <th>submitted on</th> <th>status</th> </tr> </thead>"; while($row = mysqli_fetch_array($result)) { echo "<tr class='success'>"; echo "<td>" . $row['lite_order_id'] . "</td>"; echo "<td>" . $row['lite_item_name'] . "</td>"; echo "<td>" . $row['lite_email'] . "</td>"; echo "<td>" . $row['lite_country'] . "</td>"; echo "<td>" . $row['lite_order_total'] . "</td>"; echo "</tr>"; } echo "</table>"; ?>
1 - use id attribute style individual elements. check out here
2 - in mysql query, use order by:
(i presume have id column here)
$query = "select * `yourtable` order `id` asc"; see here
Comments
Post a Comment