Jump to content

[solved] Unexpected '{' Error


Distortion

Recommended Posts

I'm getting an unexpected '{' error at line 64 but I can't see why... can you?Oh and any other comment or suggestion on my code is welcome.

<?php// Check inputif ($name || $password) {   if (!($name)) {	 print("Exuse me, but I think you forgot to fill in your name. Please try again <a href='login.php'>here</a>  ");   }   else if (!($password)) {	 print("Exuse me, but I think you forgot to fill in your password. Please try again <a href='login.php'>here</a>  ");   }   else {	// Compare to database	 $query = "SELECT * FROM username WHERE name='$name' 				 AND password='$password'";	 $result = mysql_query($query);	 if ($data = mysql_fetch_array($result)) {				print("There is allready a user with that name. Please choose another name <a href='register.php'> here </a>");	 }	 else {		// Insert into table		$sql = "INSERT INTO userdata(name,password,points,money)		VALUES('$name','$password','$points',$money)";		$result = mysql_query($sql);		// Close connection		$break = mysql_close($connection);		// Display text on page		print "Thank you sir, you can access your bank account <a href='play.php'> here </a>"[b]line 64-->[/b]	 }   }}

Link to comment
Share on other sites

The semi-colon is not required in the final statement before a closing ?> tag. Maybe that's what you saw? It's not recommended, though, since any modifications might neglect to add the semicolon. The only useful exception might be "one-liners" like <?php echo "hello" ?>, but even there a lot of programmers do it. If you never make exceptions, you'll never do it wrong. :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...