Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include 'connect.php';
- echo '<style>
- table {
- border-collapse: collapse;
- width: 100%;
- }
- th, td {
- text-align: center;
- padding: 8px;
- }
- tr:nth-child(even){background-color: #f2f2f2}
- th {
- background-color: #4CAF50;
- color: white;
- }
- </style>';
- if (empty($_SESSION['name'])) {
- echo '<p>You must be registered before posting classifieds<br>register <a href=\'register.php\'>here</a></p>';
- } else {
- $sql = 'SELECT * FROM `class` ORDER BY `id` DESC';
- $query = mysqli_query($db_con, $sql);
- echo '<table>
- <tr>
- <th>id</th>
- <th>posted on</th>
- <th>title</th>
- </tr>
- ';
- while ($r = mysqli_fetch_assoc($query)) {
- $id = $r['id'];
- $tit = $r['title'];
- $date = $r['date'];
- echo "<table>
- <tr>
- <td>$id</td>
- <td>$date</td>
- <td>$tit</td>
- </tr>";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement