Welcome Guest, Not a member yet? Register   Sign In
Displaying Single Results -- Stumped, but I know the answer is probably right in front of me =)
#1

[eluser]Greg Aker[/eluser]
I'm trying to build a REALLY simple backend for a "practice test" table that resides in my Expression Engine database.

I have watched the video tutorials & Derek Allard's tutorial (killin' by the way).

I want the administrators of the test to be able to look at & update questions that have been put in the db and I want to display them by the third URI segment, which is the ID of the question.

I am not dealing with models in this, as I want to get the bare-bones basics of CI for this really simple app.

I have the following controller, but, much to my dismay, the view file only "echo's" the word "OBJECT". Can anyone tell me what I'm doing wrong??

Thanks in advance! =)

-greg

Code:
function viewQuestion()
    {
        $data['title'] = "Question View";
        $data['heading'] = "Question View";
        
        $urlSegment = $this->uri->segment(3);

        $data['cat_id'] = $this->db->query('SELECT cat_id FROM test WHERE ques_num = "$urlSegment"');
        $data['question'] = $this->db->query('SELECT question FROM test WHERE ques_num = "$urlSegment"');
        $data['ans_1'] = $this->db->query('SELECT ans_1 FROM test WHERE ques_num = "$urlSegment"');
        $data['ans_2'] = $this->db->query('SELECT ans_2 FROM test WHERE ques_num = "$urlSegment"');
        $data['ans_3'] = $this->db->query('SELECT ans_3 FROM test WHERE ques_num = "$urlSegment"');
        $data['ans_4'] = $this->db->query('SELECT ans_4 FROM test WHERE ques_num = "$urlSegment"');
        $data['real_ans'] = $this->db->query('SELECT real_ans FROM test WHERE ques_num = "$urlSegment"');
        $data['extra'] = $this->db->query('SELECT extra FROM test WHERE ques_num = "$urlSegment"');
        $data['img'] = $this->db->query('SELECT img FROM test WHERE ques_num = "$urlSegment"');

        $this->load->view('viewQuestion_view', $data);
    }


Messages In This Thread
Displaying Single Results -- Stumped, but I know the answer is probably right in front of me =) - by El Forum - 02-03-2008, 12:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB