holowugz Posted March 9, 2006 Share Posted March 9, 2006 The problem i am having is this section of my script needs to query our forum database and check to see if a username exists.The problem is if i check for a username that contains a . EG UFDF C.Reed , i get an error.//if there is a user name and it is not blank then ...if (isset($_POST['username']) and $_POST['username'] !== "") { $colname_RS_Username = "-1"; //clean the username $colname_RS_Username = (get_magic_quotes_gpc()) ? $_POST['username'] : addslashes($_POST['username']); //select everything from the forum usertable where the username is our ewntered name mysql_select_db($database_connPASSWORD, $connPASSWORD); $query_RS_Username = sprintf("SELECT * FROM vb3_user WHERE username = '%s' AND usergroupid = 26", $colname_RS_Username);I am not sure what to actually do from here, is ther a way i can make it so it just searched for the username and not try an process it if it has a "." in it. Quote Link to comment Share on other sites More sharing options...
holowugz Posted March 9, 2006 Author Share Posted March 9, 2006 Ok i got it to work, i just removed the AND usergroupid = 26But does anyone know how i could rewrite that stsement to include :AND usergroupid = 26would appreciate any help cheers Quote Link to comment Share on other sites More sharing options...
keeB Posted March 9, 2006 Share Posted March 9, 2006 [!--quoteo(post=353319:date=Mar 9 2006, 06:07 PM:name=Luke Brown)--][div class=\'quotetop\']QUOTE(Luke Brown @ Mar 9 2006, 06:07 PM) [snapback]353319[/snapback][/div][div class=\'quotemain\'][!--quotec--]I am not sure what to actually do from here, is ther a way i can make it so it just searched for the username and not try an process it if it has a "." in it.[/quote]Your query to the database can include like that.. take this theoretical statement..[code]select * from users where login not in ( select * from users where login like '%.%' )[/code]Hope that helped.. ;) Quote Link to comment Share on other sites More sharing options...
holowugz Posted March 9, 2006 Author Share Posted March 9, 2006 Ty for your reply,i actually managed to get it working i just replaced the query with this: $query_RS_Username = "SELECT * FROM vb3_user WHERE usergroupid = 26 AND username = '$colname_RS_Username'";and it works now but ty for your reply. Quote Link to comment 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.