I have this code which lists everything in tbl_inventory for a given company which works fine:
$result_inventory = mysqli_query($con,"SELECT * FROM tbl_inventory WHERE company_id='$company_id' ORDER BY ip_address")
while($row = mysqli_fetch_array($result_inventory))
echo "<td>{$row['type']} </td>";
echo "<td>{$row['ip_address']} </td>";
echo "<td>{$row['site']} </td>";
The site column gives a number which correlates to an ID in another table which I want to use to run another query such as:
SELECT name FROM tbl_sites WHERE site_id='$site'
However I'm not sure on how to define $site from the previous result
Could someone point me in the right direction?