Advertisement
commandrea

MySQL/Bind

Apr 24th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?php
  2. $db = new mysqli(" ", " ", " ", "volsched");
  3.  
  4. if ($db->connect_errno) {
  5. echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
  6. }
  7.  
  8. $stmt = $db->prepare('UPDATE volConfirm SET confirmed = "YES" WHERE email = ?');
  9. if (!$mysqli->error) {
  10. printf("Errormessage: Email not in system %s\n", $mysqli->error);
  11. }
  12.  
  13. $stmt->bind_param('s', $_POST['email']);
  14. $stmt->execute();
  15.  
  16. $stmt = $db->prepare('SELECT agreename, position, shift_times, confirmed from volConfirm WHERE email = ?');
  17.  
  18. $stmt->bind_param('s', $_POST['email']);
  19.  
  20. $stmt->execute();
  21. $stmt->bind_result($agreeName, $position, $shift_times, $confirmed);
  22.  
  23. while ($stmt->fetch()) {
  24. // construct your output here using $row to access database record
  25. echo "<h2>" . $agreeName . "</h2>";
  26. echo "<p> You have been assigned as a volunteer for:" . $position . "</p>";
  27. echo "<p>Your shift times are scheduled for:" . $shift_times . "</p>";
  28. echo "<p>Your shift has been confirmed:" . $confirmed . "</p>";
  29. }
  30.  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement