Guest User

Untitled

a guest
Dec 10th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2. $hostname='ljtfrdb.cvrsft0i6bfz.us-east-1.rds.amazonaws.com';
  3. $username='masteruser';
  4. $password='**********';
  5.  
  6. try {
  7. $dbh = new PDO("mysql:host=$hostname;dbname=riderdb",$username,$password);
  8.  
  9. $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  10. $sql = "INSERT INTO riderInfo(partyNM, numParty, numCooler, phoneNum,pickUp)
  11. VALUES ('".$_POST["partyName"]."','".$_POST["numParty"]."','".$_POST["numCooler"]."','".$_POST["phoneNum"]". ','".$_POST["pickUP"].''")";
  12. if ($dbh->query($sql)) {
  13. echo "<script type= 'text/javascript'>alert('New Record Inserted Successfully');</script>";
  14. }
  15. else{
  16. echo "<script type= 'text/javascript'>alert('Data not successfully Inserted.');</script>";
  17. }
  18.  
  19. $dbh = null;
  20. }
  21. catch(PDOException $e)
  22. {
  23. echo $e->getMessage();
  24. }
  25. ?>
Add Comment
Please, Sign In to add comment