I need to get the id from one table in a database and use that id as a "key" in order to get the name from another table. For example
$result2 = mysql_query("SELECT * FROM XXX WHERE id=8 ")
or die(mysql_error());
while($row = mysql_fetch_array( $result2 )) {
echo $row['client_id'];
Here i get the client_id from the table 1. Now how do i implement that into this so that it returns the name and last name only of those that have the above id
$data = mysql_query("SELECT firstname, lastname FROM YYY WHERE ???? :S ")
or die(mysql_error());
Print "<table border cellpadding=3>";
while($info = mysql_fetch_array( $data ))
{
Print "<tr>";
Print "<th>fname:</th> <td>".$info['firstname'] . "</td> ";
Print "<th>lname:</th> <td>".$info['lastname'] . " </td></tr>";
}
Print "</table>";
?>