Advertisement
Guest User

Untitled

a guest
Aug 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. pessoa:
  2.  
  3. id_pessoa int(11) NOT NULL AUTO_INCREMENT,
  4. ds_pessoa varchar(20) DEFAULT NULL,
  5. agenda:
  6. id_agenda int(11) NOT NULL AUTO_INCREMENT,
  7. hr_agendamento time(11) DEFAULT NULL,
  8. id_pessoa int(11) DEFAULT NULL,
  9.  
  10. <?php
  11. $hr_agendamento = $_POST['hr_agendamento'];
  12. $id_pessoa = $_POST['id_pessoa'];
  13.  
  14. $servername = "localhost";
  15. $username = "root";
  16. $password = "";
  17. $dbname = "test";
  18.  
  19. // Create connection
  20. $conn = new mysqli($servername, $username, $password, $dbname);
  21. // Check connection
  22. if ($conn->connect_error) {
  23. die("Connection failed: " . $conn->connect_error);
  24. }
  25.  
  26. $sql = "INSERT INTO agenda (hr_agendamento, id_pessoa)
  27. VALUES ( $hr_agendamento, $id_pessoa)";
  28.  
  29. if ($conn->query($sql) === TRUE) {
  30. echo "New record created successfully";
  31. } else {
  32. echo "Error: " . $sql . "<br>" . $conn->error;
  33. }
  34.  
  35. $conn->close();
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement