Help on iterating 2 arrays and also comparing the values?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

tomex1
Forum Commoner
Posts: 26
Joined: Sun Aug 16, 2009 11:34 am

Re: Help on iterating 2 arrays and also comparing the values?

Post by tomex1 »

Hi Juma929,
I absolutely agree that JOIN can do this but that's if the two tables are in the same database I guess?
User avatar
mrvijayakumar
Forum Commoner
Posts: 58
Joined: Tue Aug 18, 2009 12:39 am
Location: Chennai city, India
Contact:

Re: Help on iterating 2 arrays and also comparing the values?

Post by mrvijayakumar »

Hello tomex1,
Brilliant question, for this, write update query with where clause to fetch record with unique primary key dear. Try it out. Come out with more questions. We can fix it..
User avatar
mrvijayakumar
Forum Commoner
Posts: 58
Joined: Tue Aug 18, 2009 12:39 am
Location: Chennai city, India
Contact:

Re: Help on iterating 2 arrays and also comparing the values?

Post by mrvijayakumar »

Hi,

Replace this, and i dont kno about derby.

if($k == $v) {
//mysql_query(); //update the table 2 value by using
using query
print "EQUAL";
}
User avatar
mrvijayakumar
Forum Commoner
Posts: 58
Joined: Tue Aug 18, 2009 12:39 am
Location: Chennai city, India
Contact:

Re: Help on iterating 2 arrays and also comparing the values?

Post by mrvijayakumar »

If not working fine means, send me entire code to my mail box. I will check it and reply u back.
User avatar
juma929
Forum Commoner
Posts: 72
Joined: Wed Jun 17, 2009 9:41 am

Re: Help on iterating 2 arrays and also comparing the values?

Post by juma929 »

Hello,

Sorry been swamped. You definatly can use joins from different databases but im used to working primarily in MySQL / MSSQL so im not sure about Derby. It may be worthwhile taking what im saying on the matter with a pinch of salt until proven otherwise due to this.

Do a little research on Derby's join abilities, in MySQL something like the following is easily possible:

SELECT db1.table1.field1, db2.table2.field2 FROM db1.table1, db2.table2 WHERE db1.table1.field1 = db2.table2.field2 ETC...

Thanks :)
tomex1
Forum Commoner
Posts: 26
Joined: Sun Aug 16, 2009 11:34 am

Re: Help on iterating 2 arrays and also comparing the values?

Post by tomex1 »

Hi Juma929,
Thanks. I definitely will have a look at Derby's join capabilities.

Cheers
tomex1
Forum Commoner
Posts: 26
Joined: Sun Aug 16, 2009 11:34 am

Re: Help on iterating 2 arrays and also comparing the values?

Post by tomex1 »

Hi mrvijayakumar,
your code does works!!!

Thanks
Post Reply