#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    15
    Rep Power
    0
    How do I compare results from a query array?
    Alil insight to what I am trying to do. Pardon the ugly code, I have just begun.

    $query0 = "select * from members whereusername = '$lusername' ";
    $result1 = mysql_query($query0);
    $row1 = mysql_fetch_array($result1);
    $query1 = "select * from members where email = '$lemail' ";
    $result2 = mysql_query($query1);
    $row2 = mysql_fetch_array($result2);
    print mysql_error();

    if strcmp($row1[username] == $row2[username])
    {redirect(); /* the redirect if above is correct */
    }else{
    print ("(try again)");
    }
    ?>

    There is most definitly an easier way to do this, but I havent a clue...
    Uga
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    $query="select * from members where username='$lusername' AND email='$lemail'";
    $result=mysql_query($query);
    if (mysql_num_rows($result))
    {
    redirect();
    }
    else
    {
    print "(try again)";
    }

    From your code it looks like you are trying to verify that the record where username = $lusername and email=$lemail are the same. The above code will do this. If no rows are returned, then there was no match.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    15
    Rep Power
    0
    Thank you, that was alot simplier than I tried to make it.

    Uga

Similar Threads

  1. sort: find duplicate string elements in array
    By sciencelife in forum Java Help
    Replies: 3
    Last Post: January 27th, 2004, 01:29 PM
  2. Show array results in X columns
    By Liviu in forum PHP Development
    Replies: 0
    Last Post: January 22nd, 2004, 06:37 AM
  3. mysql results into session array
    By TuxLives in forum PHP Development
    Replies: 10
    Last Post: January 6th, 2004, 01:09 PM
  4. Replies: 2
    Last Post: December 9th, 2003, 07:31 PM
  5. Polulating an array from MySQL query results...
    By BuddyPickle in forum PHP Development
    Replies: 2
    Last Post: November 29th, 2003, 07:42 PM

IMN logo majestic logo threadwatch logo seochat tools logo