Unexpected closing curly brace } error-Collection of common programming errors
I know this topic has been beaten into the ground, but I’m really stumped. I can’t figure out why I’m getting an unexpected } error.
My problem is with a code snippet I’ve added to a Paypal credit card terminal script. It captures the form data into a MySql database so we can keep track of billing address information, etc. It works until I add an IF statement that is supposed to only send the data to MySQL if Paypal successfully successfully captures the card info. I want to do it this way because even if the form fails to capture the CC info, it will still be added to the database as if it were successful.
Here’s the code. Again, it works until I add the if($ack="SUCCESS") {
and the corresponding closing brace at the end. If I remove the brace, I get an unexpected end error.
What is the error? In Notepad++ everything looks like it matches up.
if($ack="SUCCESS") {
$con = mysql_connect("localhost", "dbname", "dbpassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("contributors", $con);
$sql="INSERT INTO contributor_information (service, fname, lname, email, address, city, country, state, zip)
VALUES
('$_POST[service]','$_POST[fname]','$_POST[lname]','$_POST[email]','$_POST[address]','$_POST[city]','$_POST[country]','$_POST[state]','$_POST[zip]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con)
}