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.
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
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.