RyanSF07 Posted July 13, 2007 Share Posted July 13, 2007 Hi Guys, I'm getting this error: Parse error: syntax error, unexpected T_VARIABLE on line 26 with this bit of code (line 26 begins with: $check2) $usercheck = $_POST[user_name]; $check = mysql_query("SELECT * FROM registered_users WHERE user_name = $usercheck") $check2 = mysql_num_rows($check); //if the name exists, error if ($check2 = 0) { $c = TRUE; } else { $c = FALSE; $content .= "<p>'Sorry, that username is already in use.'</p>\n"; } Later in the script I have a: if $a AND $b AND $c AND $d then do the INSERT Can you help me trouble shoot this? Where is the syntax error? Thank you! Ryan Link to comment https://forums.phpfreaks.com/topic/59840-solved-unexpected-t_variable-problem/ Share on other sites More sharing options...
sasa Posted July 13, 2007 Share Posted July 13, 2007 ad ; on the end of line 25 Link to comment https://forums.phpfreaks.com/topic/59840-solved-unexpected-t_variable-problem/#findComment-297523 Share on other sites More sharing options...
RyanSF07 Posted July 13, 2007 Author Share Posted July 13, 2007 Thanks. I added it, and now get this error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /page/ on line 26 Link to comment https://forums.phpfreaks.com/topic/59840-solved-unexpected-t_variable-problem/#findComment-297527 Share on other sites More sharing options...
metrostars Posted July 13, 2007 Share Posted July 13, 2007 change the line to: $check = mysql_query("SELECT * FROM registered_users WHERE user_name = $usercheck")or die(mysql_error()); and make sure that you put the error bit on the end ofthe connection as well. Link to comment https://forums.phpfreaks.com/topic/59840-solved-unexpected-t_variable-problem/#findComment-297531 Share on other sites More sharing options...
RyanSF07 Posted July 13, 2007 Author Share Posted July 13, 2007 got it. now I get this error: Unknown column 'test' in 'where clause' the column name and $post are getting confused. What should I change to fix this? Thanks very much for your help! Link to comment https://forums.phpfreaks.com/topic/59840-solved-unexpected-t_variable-problem/#findComment-297532 Share on other sites More sharing options...
metrostars Posted July 13, 2007 Share Posted July 13, 2007 $check = mysql_query("SELECT * FROM registered_users WHERE user_name = '$usercheck'")or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/59840-solved-unexpected-t_variable-problem/#findComment-297534 Share on other sites More sharing options...
RyanSF07 Posted July 13, 2007 Author Share Posted July 13, 2007 Thanks for your help Metrostars. The single quotes did the trick. Cheers, Ryan Link to comment https://forums.phpfreaks.com/topic/59840-solved-unexpected-t_variable-problem/#findComment-297548 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.