samedi 9 juillet 2016

How to fetch query from two tables with an id from url but join based on another value on another table

Here is my challenge, I have two tables house and users. house table got the following columns hid(PRY) house_name(varchar) house_address(text) user_id(int) references users(uid)

users got uid(PRY) username(varchar) user_phone(varchar)

one my app I display available house for rent/sale. When a house is clicked, I want to show details from users tables when that user's house is selected. I picked the id from the URL but it's showing a particular user regardless of the house clicked. Am doing a join based on house.user_id and users.uid Please note that the value available on the URL is the house id URL(hid). Am working with codeigniter as well.

Aucun commentaire:

Enregistrer un commentaire