Try the following query. Then, you can do it all with one request to the database.
SELECT salaries.id AS salaries_id, salaries.name, salaries.remaining,
salaries.contract_value, contracts.provision_id AS provision_id
FROM salaries LEFT JOIN contracts ON contracts.id=salaries.id
scompt.com
2009-07-20 18:28:42