Advertisement
Guest User

Untitled

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