View Full Version : select data by ip!

02-24-2009, 07:53 PM
Fixed it ppl

Old Pedant
02-25-2009, 01:16 AM
Ummm...then you should use SQL to do that. Not a loop in PHP.

$result = mysql_query("SELECT * FROM data WHERE ip = '$ip' ");

I'm not a PHP user, so I don't know what the right function would be to use after that.

If there is a function that can ask "are there any rows in that $result" then use that. If no rows, give the error. If there are rows, then run your while loop to output the results.

CAUTION: I hope you are aware that MANY people can be sharing the same IP address! And many people will hit your site with a *different* IP address each time they come. This will be true for virtually ALL "dial up" users. Consider AOL, for example, where literally MILLIONS of users all share a few thousand IP addresses. And where each time they dial in they may be using a different IP address. But it can also be true of (for example) corporations that use proxy servers and firewalls (Microsoft, for example, will show the SAME IP address for literally hundreds of its employees). Heck, even on my little home network here, we have 3 computers on a router sharing a single IP address! AND that isn't guaranteed to be a stable IP address.

So... Don't rely too heavily on IP addresses, especially for periods longer than a few minutes.

02-25-2009, 08:09 AM
Fixed it ppl
please put the content of your post back.


02-25-2009, 03:11 PM

Please do not post to a public forum asking for help if you remove your posts afterwards.