Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <?php
- <h2> News </h2>
- // connect to the mysql database
- $con = mysql_connect("127.0.0.1","root","seedubuntu");
- mysql_select_db("test_cms", $con);
- // get the user data
- $username = $_POST['user'];
- $password = $_POST['password'];
- // query the database to select all the articles
- $sql = "SELECT * FROM articles;
- $result = mysql_query($sql);
- while ($row = mysql_fetch_assoc($result)) { # While there's another row in the result, fetch it
- echo "<p>";
- echo "<H3>" . $row['text'] . "</H3>";
- echo $row['body'];
- echo "</p>";
- }
- // close the connection to the database
- mysql_close($con);
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement