Jump to content

Comparing data from TWO DIFFERENT DATABASES


stewart715

Recommended Posts

Thank's so much for any help you can offer. Let me tell you what I have, with examples.

I have 2 databases...

DATABASE 1: thepdcom_popgallery
TABLE: g2_user

[b]g_id    g_userName[/b]
105          Linda

DATABASE 2: thepdcom_popnew
TABLE: users

[b]name[/b]
Linda

What would you suggest for a script that will output the [b]g_id[/b] (105 above) where [b]name[/b] in users = [b]g_userName[/b] in g2_user? I'm guessing you'd use a JOIN type thing... Thanks again.
Link to comment
Share on other sites

just use

<?PHP
$conn = mysql_connect("localhost", "", "");
mysql_select_db("thepdcom_popgallery", $conn) // connect to the database
$dataONE = mysql_query("SELECT * FROM g2_user") //select all the information

mysql_select_db("thepdcom_popnew", $conn) //connect to new database
$dataTWO = mysql_query("SELECT * FROM users") //select all the information

//Now to match them put your matching code here
?>
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.