scrubbicus Posted May 26, 2009 Share Posted May 26, 2009 Hey so I two columns one named 'name' and the other named 'aid'. (aid = account id) I'm trying to check to see if a user exists under an account ID because I can't have duplicate users in the same account ID but i certainly can have same usernames in different account IDs. So i was trying SELECT * FROM members WHERE username='$username' and aid='$aid' also SELECT * FROM members WHERE username='$username', aid='$aid' but neither work Quote Link to comment Share on other sites More sharing options...
lonewolf217 Posted May 26, 2009 Share Posted May 26, 2009 you said your user column was "name", not "username" so shouldn't your query be this ? SELECT * FROM members WHERE `name`='$username' and aid='$aid' Quote Link to comment Share on other sites More sharing options...
fanfavorite Posted May 26, 2009 Share Posted May 26, 2009 You beat me to it lonewolf! Quote Link to comment Share on other sites More sharing options...
lonewolf217 Posted May 26, 2009 Share Posted May 26, 2009 Quote Link to comment Share on other sites More sharing options...
scrubbicus Posted May 26, 2009 Author Share Posted May 26, 2009 right i typed that wrong but ill use that query string thanks. it is 'username' Quote Link to comment Share on other sites More sharing options...
lonewolf217 Posted May 26, 2009 Share Posted May 26, 2009 if your column really is username, then there must be some other thing you aren't telling us. I dont know your syntax since you didn't post code, so I am guessing a little <?php $sql = "SELECT * FROM members WHERE `username`='$username' and `aid`='$aid'"; $query = mysql_query($sql) or die(mysql_error()); Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 26, 2009 Share Posted May 26, 2009 The fact that you're not giving us accurate information jeopardizes our ability to help you. I would escape $username and $aid if you haven't already. Maybe they're messing up your query. 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.