AWS PHP Elastic Beanstalk上running.php时的http服务器错误500

I am developing a web application running on AWS Elastic Beanstalk with PHP configuration. When I submit an HTML form my PHP file that handles the information going to my MySQL db is getting a Server error 500. I don't know how to resolve this as my PHP knowledge is limited.

<?php
  $hostname='SOMENAME.rds.amazonaws.com';
  $username='masteruser';
  $password='**********';

  try {
    $dbh = new PDO("mysql:host=$hostname;dbname=riderdb",$username,$password);

    $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 
    $sql = "INSERT INTO riderInfo(partyNM, numParty, numCooler, phoneNum,pickUp)
    VALUES ('".$_POST["partyName"]."','".$_POST["numParty"]."','".$_POST["numCooler"]."','".$_POST["phoneNum"]". ','".$_POST["pickUP"].''")";
  if ($dbh->query($sql)) {
    echo "<script type= 'text/javascript'>alert('New Record Inserted Successfully');</script>";
  }
  else{
    echo "<script type= 'text/javascript'>alert('Data not successfully Inserted.');</script>";
  }

  $dbh = null;
  }
    catch(PDOException $e)
  {
    echo $e->getMessage();
  }
?>

The issue was in the syntax of my insert statement. I had to many quotations in it.

$sql = "INSERT INTO riderInfo(partyNM, numParty, numCooler, phoneNum, pickUp)
VALUES ('".$_POST["partyName"]."','".$_POST["numParty"]."','".$_POST["numCooler"]."','".$_POST["phoneNum"]."','".$_POST["pickUP"]."')";