For example, I have created two pages and two MySQL tables.
Index.php & citys.php
Index.php
citys.php
citys
ID
select * from citys left join comments on comments.city = citys.city where citys.id=$id
Use this query
$sql = "SELECT * FROM citys LEFT JOIN comments ON comments.city=citys.city WHERE citys.id=$id";
Use leftjoin for this type of work