code igniter codeigniter question, making anchor load page containing data from referenced row in DB

Posted by thrice801 on Stack Overflow See other posts from Stack Overflow or by thrice801
Published on 2010-06-03T19:29:44Z Indexed on 2010/06/07 23:22 UTC
Read the original article Hit count: 326

Filed under:
|
|

Hi,

Im trying to learn the code igniter library and object oriented php in general and have a question.

Ok so Ive gotten as far as making a page which loads all of the rows from my database and in there, Im echoing an anchor tag which is a link to the following structure.

[code]echo anchor("videos/video/$row->video_id", $row->video_title);[/code]

So, I have a class called Videos which extends the controller, within that class there is index and video, which is being called correctly (when you click on the video title, it sends you to videos/video/5 for example, 5 being the primary key of the table im working with.

So basically all Im trying to do is pass that 5 back to the controller, and then have the particular video page output the particular rows data from the videos table. My function in my controller for video looks like this -

[code]
function video() { $data['main_content'] = 'video'; $data['video_title'] = 'test'; $this->load->view('includes/template', $data);
} [/code]

So ya, basically test should be instead of test, a returned value of a query which says get in the table "videos", the row with the video_id of "5", and make $data['video_title'] = value of video_title in database...

Should have this figured out by now but dont, any help would be appreciated!

© Stack Overflow or respective owner

Related posts about mvc

Related posts about codeigniter