![]() |
My first question - 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: My first question (/showthread.php?tid=15144) |
My first question - El Forum - 01-27-2009 [eluser]Aimadj[/eluser] hi all I'm new here and it's my first question . i have 2 tables in data base one for videos and second for category . In page I'm need to write the category where video . My Table Code: 1-Videos I'm create this query : Code: select catname from cats left outer join videos on cats.id = videos.catid where title='Here Video title'' but m problem where I'm insert this query for work with Co -I'm use page in controllers videos.php with this code : Code: <?php and second page in views views_vi.php with this code : Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> tks very match for help me with this problem ![]() My first question - El Forum - 01-27-2009 [eluser]Rey Philip Regis[/eluser] I dont understand the question? Can you elaborate more? My first question - El Forum - 01-27-2009 [eluser]Aimadj[/eluser] [quote author="Rey Philip Regis" date="1233116715"]I dont understand the question? Can you elaborate more?[/quote] ok sorry because i'm new with this framwork . view this : i'am create this file videos.php in controllers floder with this code : Code: <?php and i'm create this file views_videos.php in views floder : Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> and in database i have this 2 table : Code: 1-Videos will now i'am need to insert in this <td> HERE I NEED INSERT THE CATEGORY NAME </td> the category where video locate . and i'am insert in videos table catid field it's field is the id of this video category . if you don't understand i'am send you example in page to view tks for your replay and i'am sorry for my bad english :red: My first question - El Forum - 01-28-2009 [eluser]umefarooq[/eluser] hi you want to find videos from you database record for a specific category. if you want to do some thing like this let me know an other thing don't put your code in next post just put your problem in proper way. My first question - El Forum - 01-28-2009 [eluser]Aimadj[/eluser] [quote author="umefarooq" date="1233156059"]hi you want to find videos from you database record for a specific category. if you want to do some thing like this let me know an other thing don't put your code in next post just put your problem in proper way.[/quote] ok tks for your replay . i have this fonction : Code: function index() { and i'am create this code in view page: Code: <?php foreach ($query->result() as $row){ ?> i'am need to insert the category name with related video . tks other time and sorry for my bad English :red: My first question - El Forum - 01-28-2009 [eluser]umefarooq[/eluser] if you want insert it in the database create a from in you view and make all fields hidden and than get all info from that form fields and put in the database. My first question - El Forum - 01-29-2009 [eluser]obiron2[/eluser] Hi, and welcome to the boards. firstly, it is not good practice to put your database calls in the controller. You should create a model for doing the database stuff, load the model and call functions in the model from the controller. in the model: Code: function details($id) in the controller: Code: function details($id) in your view: Code: foreach ($videos as $video) The controller should decide what it needs, the Model decides how to get it from the database and the view decides how it should be shown (along with CSS) Good luck and post back if you have any more issues. Obiron My first question - El Forum - 01-30-2009 [eluser]Aimadj[/eluser] tks obiron2 for your answer but . you don't understand my problem, i'am need to associeted video with categories of this video example : in video page visitor view : this video in category action tks for help me |