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. Link to comment https://forums.phpfreaks.com/topic/103662-how-come-this-doesnt-work-but-the-otherinside-works/ 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. Link to comment https://forums.phpfreaks.com/topic/103662-how-come-this-doesnt-work-but-the-otherinside-works/#findComment-530810 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. Link to comment https://forums.phpfreaks.com/topic/103662-how-come-this-doesnt-work-but-the-otherinside-works/#findComment-530840 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.