문제

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