skippa Posted April 29, 2009 Share Posted April 29, 2009 basicly, when each player of my game registers, it inserts there ip address into the database. and i would like to create a search to find out how many users and playing on the same ip address. i was thinking. search for 'username' whose is adress = 'their ip address would be here' if ip address =''their ip address would be here' show usernames.. could someone help me? thanks chris. Quote Link to comment https://forums.phpfreaks.com/topic/156174-seachphp-i-need-help-with-a-php-code/ Share on other sites More sharing options...
neogemima Posted April 29, 2009 Share Posted April 29, 2009 Well, that search would only return how many times a player has logged in from a unique IP. I would search for the IP Address, order by id "Select IP, id from database where IP = $searchIP ORDER BY id" Try something like that to return all the users on a specified IP and order them by id value. Is that what you are trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/156174-seachphp-i-need-help-with-a-php-code/#findComment-822171 Share on other sites More sharing options...
skippa Posted April 29, 2009 Author Share Posted April 29, 2009 Yeah, but instead of typing in the ip, i want to be able to type in the username and it brings up all users on the ip of that username. Quote Link to comment https://forums.phpfreaks.com/topic/156174-seachphp-i-need-help-with-a-php-code/#findComment-822173 Share on other sites More sharing options...
mikesta707 Posted April 29, 2009 Share Posted April 29, 2009 so something like $query = mysql_query("SELECT ip FROM table WHERE username='$username'"); $row = mysql_fetch_assoc($query); $query2 = mysql_query("SELECT * FROM table WHERE IP='".$row['IP']."' ORDER BY id DESC"); while ($row2 = mysql_fetch_assoc($query2)){ //do stuff here } That would get the IP for someones username, and then do another query which got every row with the same IP as the user. Hope that helps! Quote Link to comment https://forums.phpfreaks.com/topic/156174-seachphp-i-need-help-with-a-php-code/#findComment-822180 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.