Page 1 of 1

[SOLVED] Wierd Error?

Posted: Thu Aug 26, 2004 4:50 pm
by AliasBDI
I am getting this error:

Code: Select all

Parse error: parse error, unexpected T_IF, expecting ',' or ';' in page.php on line 45
Here is the surrounding code there:

Code: Select all

if ($username == $oldusername) { 
     $username_check = 0; 
} else { 
     $username_check = mysql_num_rows($sql_username_check); 
} // end if check username 

if(($username_check > 0)){
 	echo "Error1"; //include '_alert_users.php';	
	if($username_check > 0){
 		echo "Error2"; //include '_alert_users.php';
 		unset($username);
 	}
 	echo "Error3";
 	exit();  // exit the script so that we do not create this account!
}
This is line 45:

Code: Select all

if($username_check > 0){

Posted: Thu Aug 26, 2004 4:52 pm
by tim
if(($username_check > 0)){

there is no need for two (( and )) there.

Cool...

Posted: Thu Aug 26, 2004 4:58 pm
by AliasBDI
I took them off and now I'm getting this error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in page.php on line 40
This is the line:

Code: Select all

$username_check = mysql_num_rows($sql_username_check);

Posted: Thu Aug 26, 2004 5:11 pm
by feyd
How is $sql_username_check set?

Posted: Thu Aug 26, 2004 5:43 pm
by AliasBDI

Code: Select all

$sql_username_check = mysql_query("SELECT username FROM users WHERE username='$username' AND domain='$domain'");
That is it. The table name is 'user_info' and not 'users' like the code above. I changed that the page ran. Thanks for you help guys.

Posted: Thu Aug 26, 2004 6:09 pm
by tim
add a

or die (mysql_error()); on the end of that and see what it tells you

a common troubleshooting tactic =]