Fetch data from many tables |
[eluser]Lykos22[/eluser]
Hi I'd like some help please, I 've been struggling for some days but I can figure out a proper solution. I have created these 3 db tables and each table is also associated with a model, so table products has product_model, features has feature_model etc etc. Code: Table: products I have created a form in my view, in which I want to display all features (depend on the the parent category) that a product may have and assign to them some values either when adding new or editing the existing ones, for instance: - for the Apple Imac product, I want to fetch all features that belong to (parent)category_id = 1 (Computers), and assign some values to them for this specific product and store them in the database. I also use a MY_Model in my application and the function I have created so far for fetching the data from the database is this Code: // in my feature_model The problem I face is that I get nothing returned from the database, whereas if I remove the lines where the * is in the query, then the query returns feature_id // 1,2, etc etc as expected feature_name // RAM, Processor, etc etc as expected category_id // the parent category_id eg Computers as expected feature_value // all null as expected cause product_features is curerntly empty, but if a product has values for some specific features then should fetch the values that match with the product. How can I accomplish this? Any help would be appreciated. |
Welcome Guest, Not a member yet? Register Sign In |