Displaying Related Items

I’m using PHP/MySQL

I’m new to PHP.

I have two tables (see attached image). The product listing is in a table called tblListings and the related items table is called relatedItem.

The relation between the tabled is as follows:

tblListing.ID <=> related.mainID

How can I display the three related items for each Item? I think I will need to perform a Join between the two tables. I’m just not sure how.

Any help is greatly appreciated.

 
SELECT *
  FROM tblListing
JOIN relatedItem
  ON relatedItem.mainID = tblListing.ID

Check that the query actually worked by adding this line before the while

if(!$sql){ echo mysql_error(); }

and post back the results, also post your tables again, but not in attachment, it takes too long to approve