Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Thanked 0 Times in 0 Posts

    select data by ip!

    Fixed it ppl
    Last edited by Josh14; 02-25-2009 at 05:43 AM.

  2. #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,947 Times in 4,908 Posts
    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.

  3. #3
    Master Coder
    Join Date
    Dec 2007
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by Josh14 View Post
    Fixed it ppl
    please put the content of your post back.


  4. #4
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    St. Catharines, Ontario Canada
    Thanked 156 Times in 147 Posts

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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts