{"id":7263,"date":"2014-06-03T23:26:33","date_gmt":"2014-06-03T23:26:33","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/06\/03\/unexpected-closing-curly-brace-error-collection-of-common-programming-errors\/"},"modified":"2014-06-03T23:26:33","modified_gmt":"2014-06-03T23:26:33","slug":"unexpected-closing-curly-brace-error-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/06\/03\/unexpected-closing-curly-brace-error-collection-of-common-programming-errors\/","title":{"rendered":"Unexpected closing curly brace } error-Collection of common programming errors"},"content":{"rendered":"<p>I know this topic has been beaten into the ground, but I&#8217;m really stumped. I can&#8217;t figure out why I&#8217;m getting an unexpected } error.<\/p>\n<p>My problem is with a code snippet I&#8217;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.<\/p>\n<p>Here&#8217;s the code. Again, it works until I add the <code>if($ack=\"SUCCESS\") {<\/code> and the corresponding closing brace at the end. If I remove the brace, I get an unexpected end error.<\/p>\n<p>What is the error? In Notepad++ everything looks like it matches up.<\/p>\n<pre><code>if($ack=\"SUCCESS\")  {   \n    $con = mysql_connect(\"localhost\", \"dbname\", \"dbpassword\");\n    if (!$con)\n        {\n        die('Could not connect: ' . mysql_error());\n        }\n    mysql_select_db(\"contributors\", $con);\n    $sql=\"INSERT INTO contributor_information (service, fname, lname, email, address, city, country, state, zip)\n    VALUES\n    ('$_POST[service]','$_POST[fname]','$_POST[lname]','$_POST[email]','$_POST[address]','$_POST[city]','$_POST[country]','$_POST[state]','$_POST[zip]')\";\n    if (!mysql_query($sql,$con))\n        {\n        die('Error: ' . mysql_error());\n        }\n    mysql_close($con)\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I know this topic has been beaten into the ground, but I&#8217;m really stumped. I can&#8217;t figure out why I&#8217;m getting an unexpected } error. My problem is with a code snippet I&#8217;ve added to a Paypal credit card terminal script. It captures the form data into a MySql database so we can keep track [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7263","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7263"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7263\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}