SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2000
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I'm just starting php & mysql, and i'd like to be able to compare the values of 2 fields:

    ---------------------
    ID | Login | Password
    ---------------------
    1 | user1 | pwd1
    2 | user2 | pwd2
    ---------------------

    i want to be able to take the login & password values from a submitted form and loop through the records in a table then check to see if it match.
    It's like a user authentication type of code.

    If anyone can help me, i'd be grateful!


    Thank you
    Sang N.
    sang@vinasite.com
    http://www.vinasite.com [incomplete]

  2. #2
    SitePoint Wizard
    Join Date
    Apr 2000
    Posts
    1,483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I recommend is running a SELECT statement like the following:
    Code:
    SELECT * FROM tblUsers WHERE UserID = " . $username . " AND Password = " . $password
    That recordset would only contain records that match the username and pwd, therefore you would need to see if there are any records in it, if not then the logon details are invalid, if so then they are valid.

    Please reply if you need help with the code.

    Hope that helps!


Bookmarks

Posting Permissions

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