Jump to content

" syntax error, unexpected '}' "


Sami
 Share

Recommended Posts

Parse error: syntax error, unexpected '}' in /home/sami/Dokumenter/local_site/functions.php on line 17
<?php$con = mysql_connect("localhost","root","xxxxx");if (!$con)  {  die('Could not connect: ' . mysql_error());  }// Functions using MySQLfunction gbok_rm($id) {  mysql_select_db("gbok", $con);  if(mysql_query("DELETE FROM comments WHERE id='".$id."'"))   {   return true   } }function gbok_ban($ip){mysql_select_db("gbok", $con);if(mysql_query("INSERT INTO banned (ip)VALUES ('".$ip."')")) { return true }}?>

I can't see the problem :)

Edited by Sami
Link to comment
Share on other sites

you are missing semicolon here return true;

Link to comment
Share on other sites

it wants you to put semicolons at the end of your lines. Typically the line the error is referencing actually occurs on the line that comes before it. Also, you might want to consider lining up your curlcy braces in an easier to read fashion

<?php$con = mysql_connect("localhost","root","xxxxx");if (!$con){  die('Could not connect: ' . mysql_error());}// Functions using MySQLfunction gbok_rm($id){  mysql_select_db("gbok", $con);  if(mysql_query("DELETE FROM comments WHERE id='".$id."'")){	return true;  //semi-colon added here  }}function gbok_ban($ip){  mysql_select_db("gbok", $con);  if(mysql_query("INSERT INTO banned (ip) VALUES ('".$ip."')")){	return true  //semi-colon added here  }}?>

Edited by thescientist
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...