Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>News</title>
- <meta content="text/html; charset=UTF-8" http-equiv="content-type">
- <link rel="stylesheet" href="style.css" type="text/css">
- </head>
- <center><h1>News - list</h1><hr></center>
- <?php
- //connect to DB
- mysql_connect("localhost","root","") or die(mysql_error());
- mysql_select_db("news") or die(mysql_error());
- //query the db
- $getnews = mysql_query("SELECT * FROM news ORDER BY id DESC") or die(mysql_query());
- ?>
- <table>
- <tr>
- <td><b>ID #</b></td>
- <td><b>Title</b></td>
- </tr>
- <?php
- while ($row = mysql_fetch_assoc($getnews)) {
- ?>
- <tr>
- <td><?php echo $row['id']; ?></td>
- <td><?php echo $row['title']; ?></td>
- </tr>
- <?php
- }
- ?>
- </table>
- </html>
Add Comment
Please, Sign In to add comment