[SOLVED] Wierd Error?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AliasBDI
Forum Contributor
Posts: 286
Joined: Fri Nov 15, 2002 10:35 am
Location: Spring, TX, USA

[SOLVED] Wierd Error?

Post 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){
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

if(($username_check > 0)){

there is no need for two (( and )) there.
AliasBDI
Forum Contributor
Posts: 286
Joined: Fri Nov 15, 2002 10:35 am
Location: Spring, TX, USA

Cool...

Post 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);
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

How is $sql_username_check set?
AliasBDI
Forum Contributor
Posts: 286
Joined: Fri Nov 15, 2002 10:35 am
Location: Spring, TX, USA

Post 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.
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

add a

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

a common troubleshooting tactic =]
Post Reply