How to compare two fields, from 2 tables in 2 different databases ?

This is a discussion on How to compare two fields, from 2 tables in 2 different databases ? within the PHP Language forums, part of the PHP Programming Forums category; Hey im trying to do the following in PHP: Connect to 2 different databases, one named complete and one incomplete. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-12-2008
alter.fire
 
Posts: n/a
Default How to compare two fields, from 2 tables in 2 different databases ?

Hey im trying to do the following in PHP:

Connect to 2 different databases, one named complete and one
incomplete.

My goal is to find whats missing in the "incomplete" database.

The fields i want to compare in the database/table is named 'name' in
both. This field is comtaining unique names

How would you guys do that? arr1 vs arr2 compare or maybe some left
join sql?
I want to output the diff to screen.

Anyone can show me a sample, to get me in the right direction?

Thanks in advance
Jan
Reply With Quote
  #2 (permalink)  
Old 05-12-2008
Mike Lahey
 
Posts: n/a
Default Re: How to compare two fields, from 2 tables in 2 different databases?

alter.fire wrote:
> Hey im trying to do the following in PHP:
>
> Connect to 2 different databases, one named complete and one
> incomplete.
>
> My goal is to find whats missing in the "incomplete" database.
>
> The fields i want to compare in the database/table is named 'name' in
> both. This field is comtaining unique names
>
> How would you guys do that? arr1 vs arr2 compare or maybe some left
> join sql?
> I want to output the diff to screen.
>
> Anyone can show me a sample, to get me in the right direction?
>
> Thanks in advance
> Jan


Not too hard to do in php... Make 2 arrays with the names and array_diff
them.
Reply With Quote
  #3 (permalink)  
Old 05-12-2008
iTech7.com
 
Posts: n/a
Default Re: How to compare two fields, from 2 tables in 2 different databases?

On May 12, 6:26 am, Mike Lahey <mikey6...@yahoo.com> wrote:
> alter.fire wrote:
> > Hey im trying to do the following in PHP:

>
> > Connect to 2 different databases, one named complete and one
> > incomplete.

>
> > My goal is to find whats missing in the "incomplete" database.

>
> > The fields i want to compare in the database/table is named 'name' in
> > both. This field is comtaining unique names

>
> > How would you guys do that? arr1 vs arr2 compare or maybe some left
> > join sql?
> > I want to output the diff to screen.

>
> > Anyone can show me a sample, to get me in the right direction?

>
> > Thanks in advance
> > Jan

>
> Not too hard to do in php... Make 2 arrays with the names and array_diff
> them.


I don't think it displays a nice difference ?
Reply With Quote
  #4 (permalink)  
Old 05-12-2008
Jerry Stuckle
 
Posts: n/a
Default Re: How to compare two fields, from 2 tables in 2 different databases?

alter.fire wrote:
> Hey im trying to do the following in PHP:
>
> Connect to 2 different databases, one named complete and one
> incomplete.
>
> My goal is to find whats missing in the "incomplete" database.
>
> The fields i want to compare in the database/table is named 'name' in
> both. This field is comtaining unique names
>
> How would you guys do that? arr1 vs arr2 compare or maybe some left
> join sql?
> I want to output the diff to screen.
>
> Anyone can show me a sample, to get me in the right direction?
>
> Thanks in advance
> Jan
>


I'm assuming you're using MySQL - just because most people here are. If
so, you don't even need PHP. Try comp.databases.mysql for a SQL only
solution.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:11 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0