Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.