Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('connect.php');
- ?>
- <html>
- <head>
- <title>pro tytul</title>
- <style type="text/css">
- .table_titles, .table_cells_odd, .table_cells_even {
- padding-right: 20px;
- padding-left: 20px;
- color: #000;
- }
- .table_titles {
- color: #FFF;
- background-color: #666;
- }
- .table_cells_odd {
- background-color: #CCC;
- }
- .table_cells_even {
- background-color: #FAFAFA;
- }
- table {
- border: 2px solid #333;
- }
- body { font-family: "Trebuchet MS", Arial; }
- </style>
- </head>
- <body>
- <h1>pro tabela</h1>
- <table border="0" cellspacing="0" cellpadding="4">
- <tr>
- <td class="table_titles">id</td>
- <td class="table_titles">test</td>
- <td class="table_titles">abc</td>
- </tr>
- <?php
- $result = mysql_query("SELECT * FROM testabc ORDER BY id DESC");
- $oddrow = true;
- while( $row = mysql_fetch_array($result) )
- {
- if ($oddrow)
- {
- $css_class=' class="table_cells_odd"';
- }
- else
- {
- $css_class=' class="table_cells_even"';
- }
- $oddrow = !$oddrow;
- echo '<tr>';
- echo ' <td'.$css_class.'>'.$row["id"].'</td>';
- echo ' <td'.$css_class.'>'.$row["test"].'</td>';
- echo ' <td'.$css_class.'>'.$row["abc"].'</td>';
- echo '</tr>';
- }
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment