Mailing List Archive



Back to the month index Back to the list index

wilson li (msql2@yahoo.com)
Wed, 21 Apr 1999 17:13:19 -0700 (PDT)


Message-ID: <19990422001319.19991.rocketmail@web507.yahoomail.com>
Date: Wed, 21 Apr 1999 17:13:19 -0700 (PDT)
From: wilson li <msql2@yahoo.com>
Subject: How to compare two record sets using Lite?

Hi All,
I want to compare two record sets resulted from two
queries using Lite code similar to the following:
while ( #$row1 > 0 ) {
    while (#$row2 > 0 ) {
        if ($row1[1] == $row2[1] ){
              /* do something */
        }
        $row2 = msqlFetchRow ($res2);
    }
    $row1 = msqlFetchRow ($res1);
}
The problem is that, after looping through $res2 once,
there seems no way to set the pointer in $res2 back to
the first record again. So the second while loop can
only run once and I can't use the above code to
compare each record in $rec1 with each record in
$rec2.
I understand that I can extract all the records in
$rec2 into an array and then do the comparison. But
before doing that, I want to make sure that there is
no better methods for handling this problem.
Any help will be highly appreciated!
Wilson

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com