I am trying to do an SQL query that will take details from different tables.
E.G.
Products { ID, Title, Description, Price}
Offering { ID, ProductId, Price, UserID, Condition}
User { ID, Username, etc}
I would like it so that it displays returns all the offerings of a specific product. Each product can have multiple offerings. And a user can place an offering. (An offering is when someone lists their own item to sell) For example the product would be a Harry Potter Book, any user can list there copy of the book for sale as an offering.
$offering = mysqli_query($con, SELECT offering.price, offering.comment, offering.productid, user.username
FROM offering
INNER JOIN username on (offering.userid=offering.userid)
WHERE offering.productid = $productid );
This should return each offering back as a row with the username of the user that has placed the offering.
At the moment it is returning multiple rows of the same offering each time display the offering with a different userid.
I am not sure if I have explained it properly!
$offering = mysqli_query($con, "SELECT offering.price, offering.comment,
offering.productid, user.username from offering,user where user.ID=offering.UserID;");