Advertisement
Guest User

Untitled

a guest
Mar 17th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2. $db_host = "localhost";
  3. $db_username = "root";
  4. $db_password = "123";
  5. $db_database = "testMySQL";
  6. ?>
  7.  
  8. <!DOCTYPE html>
  9. <html>
  10. <head>
  11. <title>Test DB</title>
  12. </head>
  13. <body>
  14. This is a normal HTML
  15.  
  16. <br><br>
  17.  
  18. <?php
  19. $db = mysql_connect($db_host, $db_username, $db_password);
  20. if (!$db) {
  21. die('Could not connect: ' . mysql_error());
  22. }
  23. echo 'Connected successfully';
  24.  
  25. mysql_select_db($db_database, $db) or die('Could not select database.');
  26. ieu
  27. $sql = "SELECT * FROM customer;";
  28.  
  29. $result = mysql_query($sql);
  30.  
  31. while($row = mysql_fetch_assoc($result)) {
  32. //echo '123';
  33. echo $row['customer_id'];
  34. echo $row['customer_name'];
  35. echo $row['customer_dob'];
  36. echo $row['customer_comment'];
  37. }
  38. ?>
  39. </body>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement