Insert to another table, then compare tables rows

4 messages Options
Embed this post
Permalink
jigen7

Insert to another table, then compare tables rows

Reply Threaded More More options
Print post
Permalink
Hi how can compare two rows in two diffrent table and return the columns and his values that are not equal so for example i have table1 and table 2 that has column sum, and vehid , in table1 the sum = 20 and vehid = 1 while in table2 sum=20 and vehid = 2. so the output must return vehid as on those two table are not equal??
Hector Virgen

Re: Insert to another table, then compare tables rows

Reply Threaded More More options
Print post
Permalink
You can use array_diff for that:

$rowArray1 = $row1->toArray();
$rowArray2 = $row2->toArray();
$diff = array_diff($rowArray1, $rowArray2);
var_dump($diff);

--
Hector


On Tue, Oct 20, 2009 at 7:08 PM, jigen7 <[hidden email]> wrote:

Hi how can compare two rows in two diffrent table and return the columns and
his values that are not equal so for example i have table1 and table 2 that
has column sum, and vehid , in table1 the sum = 20 and vehid = 1 while in
table2 sum=20 and vehid = 2. so the output must return vehid as on those two
table are not equal??
--
View this message in context: http://www.nabble.com/Insert-to-another-table%2C-then-compare-tables-rows-tp25985445p25985445.html
Sent from the Zend DB mailing list archive at Nabble.com.


jigen7

Re: Insert to another table, then compare tables rows

Reply Threaded More More options
Print post
Permalink
thanks ill try that , now the problem is how can i display it with format so i can get it display

format: Column name orig value => new value
ex loan_term 1=>2
jigen7

Re: Insert to another table, then compare tables rows

Reply Threaded More More options
Print post
Permalink
In reply to this post by Hector Virgen
thanks ill try that , now the problem is how can i display it with format so i can get it display

format: Column name orig value => new value
ex loan_term 1=>2