I am creating a PHP/MySQL web site. On one page there is a table which is showing a recordset of users (Recordset1). One of the users field is company (idempresa), where I am storing the id field from the table companies. The table shows the user fields: username, email, company. As you may guess, the cell for the company value shows the company value (idempresa) and not the company name which is part of Recordset2. This the code for the cell:

<?php echo $row_Recordset1['idempresa']; ?>

How could I update the cell content to show the company name?

有帮助吗?

解决方案

Best place would be in your query as a Left Join. Then you will have both record sets in one. Here is a link to an example: w3schools.com/sql/sql_join_left.asp

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top