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
AliasBDI
Forum Contributor
Posts: 286 Joined: Fri Nov 15, 2002 10:35 am
Location: Spring, TX, USA
Post
by AliasBDI » Thu Aug 26, 2004 4:50 pm
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:
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Thu Aug 26, 2004 4:52 pm
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
Post
by AliasBDI » Thu Aug 26, 2004 4:58 pm
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);
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Aug 26, 2004 5:11 pm
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 » Thu Aug 26, 2004 5:43 pm
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.
tim
DevNet Resident
Posts: 1165 Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio
Post
by tim » Thu Aug 26, 2004 6:09 pm
add a
or die (mysql_error()); on the end of that and see what it tells you
a common troubleshooting tactic =]