Jump to content

[SOLVED] What is wrong with this code?


papaface

Recommended Posts

Hello,

I am having a problem with a piece of code.

I get this error:

Parse error: syntax error, unexpected T_VARIABLE in /home/**/public_html/qss/includes/memberfunctions.php on line 24

 

			function CheckUsername($username)
			{
			$username = trim($username);
			if	($username != "" || $username != " ")
				{
                		$check = mysql_query('SELECT `username` FROM `members` WHERE `username`="{$username}"');
               		 if	(mysql_num_rows($check) == 0)
                		{
                		$this->username = $username;
                		return true;
                		}
                	else
				return false;
			}
			else
				return false;
			}//line24	

I have commented line 24 at the bottom. I can't see what is wrong ???

Link to comment
https://forums.phpfreaks.com/topic/83404-solved-what-is-wrong-with-this-code/
Share on other sites

It is formatted actually, just its not inserting correcting in this forum. There are the right amount of braces.

Hopefully this will paste properly

function CheckUsername($username)
{
$username = trim($username);
if	($username != "" || $username != " ")
	{
          	$check = mysql_query('SELECT `username` FROM `members` WHERE `username`="{$username}"');
		if	(mysql_num_rows($check) == 0)
			{
				$this->username = $username;
				return true;
			}
                else
			return false;
	}
else
	return false;
}	

 

P.S This is part of a class.

Edit:

Fixed. I missed a ; LATER on in the script  ???

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.