Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2.  
  3.   // DB details
  4.     $hostname = "whatever";
  5.     $username = "whatever";
  6.     $password = "whatever";
  7.     $dbname = "whatever";
  8. // Create connection
  9.     $conn = new mysqli($hostname, $username, $password, $dbname);
  10.     // Check connection
  11.     if ($conn->connect_error) {
  12.         die("Connection failed: " . $conn->connect_error);
  13.     }
  14.     $sql = "SELECT * FROM relevant_topics";
  15.     $result = $conn->query($sql);
  16.        if ($result->num_rows > 0) {
  17.         // Removing special characters from rows.
  18.         while($row = $result->fetch_assoc()) {
  19.              $cardID = $row["cardID"];
  20.        
  21.         echo '<div class="card">"$cardID"</div>';
  22. }
  23. }
  24. else {
  25.     echo 'connection failed';
  26. }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement