simple data passing query - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: simple data passing query (/showthread.php?tid=49226) |
simple data passing query - El Forum - 02-11-2012 [eluser]junaids[/eluser] Hi, I am trying to pass two things through the data variable. But I cant figure out how to use them in the view. Here is the code.. Code: function show_products() Code: <div id="blank_gallery">Product Description</div> Now there are two foreach in the view.. I want to dispaly the product image and its description in one div(foreach). Suggestions please.. simple data passing query - El Forum - 02-12-2012 [eluser]Bhashkar Yadav[/eluser] you can fetch all these info from one model function and can pass into view. simple data passing query - El Forum - 02-12-2012 [eluser]junaids[/eluser] The images are returned from the directory and the data is returned from db..so i dont think they can be returned in one query.. Code: function show_products() or I can store images in the db. Can someone show me how to display images returned from db? simple data passing query - El Forum - 02-12-2012 [eluser]vitoco[/eluser] I think that if you use product_id (int) as name for the images, you can put it as index in the images array and then call it inside the products foreach Code: // product_id = 100001 => image => 100001.png/gif/jpeg Code: foreach ($files as $file) { Code: <? Saludos simple data passing query - El Forum - 02-12-2012 [eluser]junaids[/eluser] thanx vitoco.. i have defined 'id' in the table. But I dont get how the images can be retrieved from the directory based on the id..I used ur code and get this error. Code: Product Name : camera simple data passing query - El Forum - 02-12-2012 [eluser]vitoco[/eluser] as i wrote, the code works only if the name of the image contains de id of the product, so how are you creating the name of the images?, please give an example simple data passing query - El Forum - 02-12-2012 [eluser]junaids[/eluser] @vitoco..need your advice simple data passing query - El Forum - 02-12-2012 [eluser]vitoco[/eluser] very simple...if the product id is "1" , the image must be "1.png" ( or any other image extension ), so the id and the name match and you can have a "reference" from one the other, and also use the id as index in every array of "objects" related to the product. simple data passing query - El Forum - 02-12-2012 [eluser]junaids[/eluser] thanx vitoco..it helped |