doublea2k7 Posted May 1, 2008 Share Posted May 1, 2008 i have a table called accounts inside there is ID NAMe password now users dont know their id so they would have to enter their name. So this code [code]if ($query=mysql_query("update accounts set loggedin='1' WHERE name='$name'")) { echo "Your account has been fix try to log in the game now!"; but this works because it finds the id which is the primayr index ($query=mysql_query("update accounts set loggedin='1' WHERE id='$id'")) { echo "Your account has been fix try to log in the game now!";[/code] but the user doesn know their id how could i get the name and then get the id so the update will work. Quote Link to comment Share on other sites More sharing options...
peranha Posted May 1, 2008 Share Posted May 1, 2008 You are saying that they second one works, and the first one doesnt? If that is the case, echo $name, and see if there is a value there. Quote Link to comment Share on other sites More sharing options...
pwes24 Posted May 1, 2008 Share Posted May 1, 2008 If they only know their name, you can use that so instead of saying 'WHERE id=$id', you say 'WHERE name=$name' and use it to get the id. Just the opposite of what you're doing now. 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.