SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 1999
    0 Post(s)
    0 Thread(s)
    Here is my problem.

    I have the following fields in a database that are related to the problem.

    fname (users first name)
    lname (users last name)
    pickf (another users first name)
    pickl (another users last name)

    See a client wants to make a niche dating system where someone enters a first name(pickf) and last name(pickl) of someone else.

    Now if that person that he picked put his first name in pickf and his last name in pickl, I need a script that will say that he has a match.

    That is kind of confusing.. here is another explanation.

    Bob logs on to the web site and registers under the name: Bob Doe(fname=Bob and lname=Doe). He then logs in and types in Jane for the field pickf and Doe for the field pickl.

    1 week later....

    Jane Doe registers for service. (fname=Jane and lname=Doe). She then types in Bob for the field pickf and Doe for the field pickl.

    Now both people technically entered the other persons name.

    I am in need for a script to check to see if Bob Doe's pickf/pickl is the name of someone that has their pickf and pickl Bob Doe.

    Please help me on this.

    I am only looking for the query or lines of code.

    I know php fairly well but I am stuck on this.

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    San Diego, CA
    0 Post(s)
    0 Thread(s)
    are you somehow tracking the fname and lname of the person who is logged in let's say you are and you have four session vars named $userfname, $userlname, $userfpick and $userlpick

    $result = mysql_query("SELECT * from tablename WHERE pickf = '$userfname' AND pickl = '$userlname'");

    if (mysql_num_rows($result) > 0) {
    while($row = mysql_fetch_array($result)) {
    if (($row["fname"] == $userfpick) && ($row["lname"] == $userlpick)) {
    print "We have a match";
    else {
    print "No match";
    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Posting Permissions

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