Advertisement
Guest User

Untitled

a guest
Mar 7th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1.     <html>
  2.     <body>
  3.     <?php
  4.      <h2> News </h2>
  5.       // connect to the mysql database
  6.       $con = mysql_connect("127.0.0.1","root","seedubuntu");
  7.       mysql_select_db("test_cms", $con);
  8.      
  9.       // get the user data
  10.       $username = $_POST['user'];
  11.       $password = $_POST['password'];
  12.      
  13.       // query the database to select all the articles
  14.       $sql = "SELECT * FROM articles;  
  15.      $result = mysql_query($sql);
  16.    
  17.      while ($row = mysql_fetch_assoc($result)) { # While there's another row in the result, fetch it
  18.         echo "<p>";
  19.     echo "<H3>" . $row['text'] . "</H3>";
  20.     echo $row['body'];
  21.     echo "</p>";
  22.      }
  23.      // close the connection to the database
  24.      mysql_close($con);
  25.    ?>
  26.     </body>
  27.     </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement