Results 1 to 3 of 3

Thread: [RESOLVED] searching a db!

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2007
    Posts
    45

    Resolved [RESOLVED] searching a db!

    Hi I just made a login script that actually works, lol It stores the data in a db called user. That table has 4 fields. id, user, pass and ip. When i log in on my page my ip is stored in the tabel. But here is some code im doing on another page. I need some help!
    PHP Code:
    mysql_connect(''''''); //<--- connects to sql
    mysql_select_db(''); // <--- selects db
    $ip $_SERVER['REMOTE_ADDR']; //<--- gets your ip address

    mysql_query("SELECT * FROM user ORDER BY id")

    if (***
    $ip is found somewhere in db***){  // <---I don't know how to make that query!
    echo "you are logged in"
    }
    else {
    echo 
    "Gotta log in first!" 
    ;
    }

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: searching a db!

    IP addresses are potentially volatile. Use cookie-based sessions instead.

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2007
    Posts
    45

    Re: searching a db!

    Ok, but i found the problem... I should use COUNT in query... thx anyway!

Posting Permissions

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



Click Here to Expand Forum to Full Width