Jump to content

Seach.php I Need help with a php code.


skippa

Recommended Posts

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.

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.