Guest User

Untitled

a guest
Aug 14th, 2018
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2.  
  3. // Connection Information
  4. $db_host = 'localhost';
  5. $db_database = 'tdb';
  6. $db_username = 'root';
  7. $db_password = 'root';
  8. $db_port = '8889';
  9.  
  10. $conn = new mysqli($db_host , $db_username , $db_password , $db_database , $db_port);
  11. // Connection Check
  12. if ($conn->connect_errno > 0) {
  13. die('Unable to connect to database [' . $conn->connect_error . ']');
  14. }
  15.  
  16. // Add Arabic Charsets
  17. date_default_timezone_set('UTC'); // change server zone to UTC
  18. $conn->set_charset("utf8"); // change collation to UTF-8
  19.  
  20.  
  21. // DB selection from SQL
  22. $sql = "SELECT * FROM circulars";
  23. if (!$result = $conn->query($sql)) {
  24. die('There was an error running the query [' . $conn->error . ']');
  25. }
  26.  
  27. // Fetch Data from SQL to table
  28. while($row = mysqli_fetch_assoc($result)){
  29. echo "<tr><td>" . $row["id"] . "</td><td>" . $row["titlet"] . "</td><td>" . $row["publicationDate"] . "</td><td><a href=".$row["view"].">View</a></td></tr>";
  30. }
  31.  
  32.  
  33.  
  34. echo "</table>";
Add Comment
Please, Sign In to add comment