Error in inserting data in a table

I am having problem in inserting the values in my table. same code runs good for inserting other informations in another table.

$query=‘INSERT INTO birthdays(names,bdate,bmonth,username,pin) VALUES ("$name","$bdate","$bmonth","$nn","$pp")’;

alert(‘Name inserted successfully’);

      </script> <?php
  else echo "Error in running query";

If you are a beginner checkout or to troubleshoot your code with other developers/coders etc.