Guest User

Untitled

a guest
Nov 13th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. $sql = "INSERT INTO MyGuests (firstname, lastname, email)
  2. VALUES ('John', 'Doe', 'john@example.com')";
  3.  
  4. <?php
  5. $servername = "localhost";
  6. $username = "username";
  7. $password = "password";
  8. $dbname = "myDBPDO";
  9.  
  10. try {
  11. $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
  12. // set the PDO error mode to exception
  13. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  14. $sql = "INSERT INTO MyGuests (firstname, lastname, email)
  15. VALUES ('John', 'Doe', 'john@example.com')";
  16. // use exec() because no results are returned
  17. $conn->exec($sql);
  18. echo "New record created successfully";
  19. }
  20. catch(PDOException $e)
  21. {
  22. echo $sql . "<br>" . $e->getMessage();
  23. }
  24.  
  25. $conn = null;
  26. ?>
  27.  
  28. '$mailAssistente5,
  29.  
  30. '$mailAssistente5'
Add Comment
Please, Sign In to add comment