Matching data in two databases
Hi
I am trying to collect data from one database and match the result of the first datatbase to the second databases data. I Then want to echo the matches ranked based on the number of matches found for the individual variables. The echo would have a maximum of 20 results.
This is some of my early trials could some one help me please.
<? Php
connect=include('connect.php')
//This code sets the current logged in individual.
$id= $_SESSION['id'];
$person=mysql_query("SELECT * FROM Users WHERE id='$id'")
//This echos the data results from the database query.
while($row=mysql_fetch_assoc($person))
{
echo ' $rows['age'];$rows['country'];
$rows['city'];
$rows
}
// This querys the second database. The plan is to display and rank at least 20 results based on how closely
they match the first queries results. I first created viarables of the first database results.
$age=$rows['age'];
$country=$rows['country'];
$city=$rows['city'];
// This queries the second datbase.
$account=mysql_query("SELECT * FROM account WHERE ages='$age', country='$country' city='$city'")
//This echos the result
while($num=mysql_fetch_assoc($account))
{
echo 'num['age'];
num['country'];
num['city'];';
num['otherdata'];
}
// otherdata variable output other data in the database from the multiple echoed results.
I want to limit the results to 20 and rank them according to the most matching from first database results. Please help. Just reply if any part does make sense.
