query for getting row from table |
[eluser]talwinder[/eluser]
Hi, Currently i am working on a site. I have a table named product in the database. In table there is about 20 rows means 20 products with id's 1-20. From that table i just want to select only 3 rows. E.g I want to select row which have id of 1, 6 and 15. I am juggling with it and unable to get right query. PLEASE HELP!!!
[eluser]toopay[/eluser]
if you are try to get non-grouped result, you can write some function in your model... Code: ... and to use above function, in your case now you can put something like this in your controller ... Code: $data['my_list'] = $this->model_name->get_list('table_name','id',array(1,6,15));
[eluser]toopay[/eluser]
forgot 1 line in while statement, here you go... Code: ...
[eluser]talwinder[/eluser]
thanks for help. I am quite new to codeigniter. So not much familiar with it. Js wanna know is it gud practive to use model directly into the veiw ???? This the following html for which I want to pull data dynamicly <div class="abc" id="cde"> <h2></h2> <h3></h3> <p></p> </div> I have about 20 <div> in a page with unique id but same structure. I want to get <h2>, <h3> and <p> from database. and all 20 products shout display in the page. and how can i echo particular field data in particular div say if i want to echo field which have id 5 and i want to echo that row in <div> 10
[eluser]toopay[/eluser]
[quote author="talwinder" date="1302146159"]thanks for help. I am quite new to codeigniter. So not much familiar with it. [/quote] Then, you need to read about Controller, Model and View Section in User Guide ... |
Welcome Guest, Not a member yet? Register Sign In |