Jump to content

matching -->data_from_two


RON_ron

Recommended Posts

I've 2 databases with a lot of records. I need a way to pull all the records of my_db2 and at the same time to pull the relevant record from my_db2  as a string.(e.g.  NAME and CITY and ELIGIBILITY.).

This is my code. But not outputting the way I want. (outputs only the first record).

 

$query1 = "SELECT Name, City FROM my_db1 ORDER BY City DESC";

$results1 = mysql_query($query1);

 

while($line1 = mysql_fetch_array($results1)) {

$person = $line1["Name"];

echo $line1["Name"]." and ";

echo $line1["City"]." and ";

}

$query2 = "SELECT eligibility FROM my_db2 WHERE name=$person";

$results2 = mysql_query($query2);

while($line2 = mysql_fetch_array($results2))

{

echo $line2["eligibility"].".";

}

Link to comment
https://forums.phpfreaks.com/topic/268056-matching-data_from_two/
Share on other sites

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.