在PHP的mysql结果中,我可以用不同的表中的相应值替换列吗?

I am using PHP to get results from a MySQL table. The mysql_query returns in variable $r. Suppose I am selecting Employee ID, Employee_team and Employee_salary in my original query. Can I replace the Employee ID in $r(or a new variable with rest of the data intact) with corresponding Employee Names which have to be queried from a different table using the Employee ID?

$r = mysql_query($query);

    if (!$r)
        error_log("Error: " . mysql_error());

Try to Join the 2 tables in 1 query. And select the fields you want.

If the database is on other server, create temporary table and query data from another server into it. Then use JOIN with temporary to select data you need.

you can join two table and select any field you want from tables

select t1.employee_team,t1.employee_salary,t2.employee_name
from table1 as t1
left join table2 as t2 on t2.employee_id = t1.employee_id