Jump to content

Error


Kyza

Recommended Posts

Hey,Im working on my site, and I keep getting this error:Parse error: syntax error, unexpected T_FUNCTION in C:\wamp\www\test\a+BB\global.php on line 6The code im using is:<?php$con = mysql_connect("localhost" , "name" ,"password") or die(mysql_error());mysql_select_db("database name", $con)function mss($value){ return mysql_real_escape_string(trim(strip_tags($value)));}function topic_go($id){ echo "<meta http-equiv=\"refresh\" content=\"0;url=index.php?act=topic&id=".$id."\">";}function s($value){ return stripslashes($value);}function topic($input){ // bbcode return nl2br(strip_tags(stripslashes(htmlentities(htmlspecialchars($input)))));}function uid($uid, $link = FALSE){ $sql = "SELECT username FROM `users` WHERE `id`='".$uid."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ return "Invalid User"; }else { $row = mysql_fetch_assoc($res); if(!$link){ return $row['username']; }else { return "<a href=\"/tuts/forum/index.php?act=profile&id=".$uid."\">".$row['username']."</a>"; } }}function post($uid){ $sql = "SELECT * FROM `forum_replies` WHERE `uid`='".$uid."'"; $res = mysql_query($sql) or die(mysql_error()); return mysql_num_rows($res);}function isa($uid){ $sql = "SELECT admin FROM `users` WHERE `id`='".$uid."'"; $res = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($res); return $row['admin'];}?>

Link to comment
Share on other sites

missed a semicolon.mysql_select_db("database name", $con);

Link to comment
Share on other sites

FWIW, and to anyone who still cares, unexpected {something} usually means that some sort of delimiter is missing. Usually it is a missing semicolon, as in this case. A closing paren or closing brace (when absent) can also cause the error.When the missing delimiter is a brace, the exact location of the error can be hard to track down, because the PHP parser might not notice it until many lines after the missing item. Code editors that draw lines between the start and finish of control structures can be a big help.

Link to comment
Share on other sites

When the missing delimiter is a brace, the exact location of the error can be hard to track down, because the PHP parser might not notice it until many lines after the missing item. Code editors that draw lines between the start and finish of control structures can be a big help.
This is why I've gotten into the habit of immediately closing my code blocks when I start them. Some code editors do this for you but mine doesn't...
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...