need help with php/mysql, anyone?

i need to join two different server and compare their tables. and find match email in both server tables. One table name is recover_unsub1 in recover(databse) and other table name is popular_screamer_archive in popular (databse) both table in different server.

[php]

<?php $master = mysql_connect("master_host","10.0.4.67","asramercy"); $slave = mysql_connect("slave_host","10.0.4.64","asramercy"); if(mysql_select_db("recover",$master) && mysql_select_db("popular",$slave)) { // stuff } else { echo mysql_error(); } //Both Selected $sql = mysql_query("SELECT * FROM recover_unsub1",$master); $rows = array(); while($row = mysql_fetch_assoc($sql)) { $slave_sql = mysql_query("SELECT * FROM popular_screamer_archive1 WHERE email = " . $row['email'],$slave); while($sub_row = mysql_fetch_assoc($slave_sql)) { $row = array_combine($sub_row,$row); } $rows[] = $row; } } ?>

[/php]

Error# code not doing anything

I’m in a rush I figured an answer is better than no answer. Horrible procedural code. If you haven’t found a solution I’ll edit this post and update it when I get home.


<?php

define("DB_HOST", "");
define("DB_USER", "");
define("DB_PWD", "");
define("DB_NAME", "");

$con = new mysqli(DB_HOST, DB_USER, DB_PWD, DB_NAME);

$query1 = "SELECT ENTER_TABLE_NAME FROM DB_NAME";


if ($result = mysqli_query($con, $query1)) 
{	
	while($row1 = mysqli_fetch_assoc($result))
	{
		for($i = 0; $i<count($r1); $i++)
		{
			$email = $r1[$i]['email'];
			if($result2 = mysqli_query($con, "SELECT * FROM TABLE_NAME WHERE email = '$email'"))
			{
				while($row2 = mysqli_fetch_assoc($result2))
				{
					$r2[] = $row2;
				}
			}
		}
	}		
}



 
 

 

 ?>            
 

Considering I know you have asked this on several boards and are less interested in fixing the code than having someone rewrite it for you. I could be a dick and lock the post. Last I read your error had to do with not finding the database, has that changed?

Hi Lirant. the code you sent its not doing anything, its not giving my any ouptut. can you edit it and post again. Thank You

That right there proves my point.

Sponsor our Newsletter | Privacy Policy | Terms of Service