Jump to content

" syntax error, unexpected '}' "


Sami

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 :)

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  }}?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...