papaface Posted December 27, 2007 Share Posted December 27, 2007 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 ??? Quote Link to comment https://forums.phpfreaks.com/topic/83404-solved-what-is-wrong-with-this-code/ Share on other sites More sharing options...
PHP_PhREEEk Posted December 27, 2007 Share Posted December 27, 2007 If this code was even the slightest bit formatted, the error would probably jump right out. As it is, I can't make sense of the braces... sorry PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/83404-solved-what-is-wrong-with-this-code/#findComment-424325 Share on other sites More sharing options...
papaface Posted December 27, 2007 Author Share Posted December 27, 2007 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 ??? Quote Link to comment https://forums.phpfreaks.com/topic/83404-solved-what-is-wrong-with-this-code/#findComment-424327 Share on other sites More sharing options...
PHP_PhREEEk Posted December 27, 2007 Share Posted December 27, 2007 Yeah, this forum seems to do weird things with tabs... I used to work with tabs, but now I format with spaces so that it posts correctly.. anyways, glad you got your problem solved! PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/83404-solved-what-is-wrong-with-this-code/#findComment-424369 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.