Advertisement
Guest User

Untitled

a guest
Mar 29th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set('display_errors', 1);
  4. error_reporting(E_ALL);
  5.  
  6. $host = "xxxxx";
  7. $user = "xxxxx";
  8. $pass = "xxxxx";
  9. $db = "xxxxx";
  10.  
  11. $conn = mysqli_connect($host, $user, $pass, $db);
  12.  
  13. if(!$conn)
  14. {
  15. die("Connection Failed: " . mysqli_connect_error());
  16. }
  17.  
  18.  
  19. $sql = "SELECT QId, Question FROM Questions";
  20. $result = mysqli_query($conn, $sql);
  21.  
  22. if (mysqli_num_rows($result) > 0)
  23. {
  24. // output data of each row
  25. while($row = mysqli_fetch_assoc($result))
  26. {
  27. // THIS WORKS echo "id: " . $row["Question"]. "<br>";
  28.  
  29. echo " <label><input type="checkbox" id="Questions" value="$row[QId]"> $row[Question]</label><br>";
  30.  
  31. }
  32. }
  33.  
  34. else
  35. {
  36. echo "0 results";
  37. }
  38. $conn->close();
  39.  
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement