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 =)
#4

[eluser]Greg Aker[/eluser]
Wow, fast responses! Many thanks.

I have tried both things you have suggested, and I am afraid I'm still banging my head against my desk.

in order to keep the code short, my controller is:
Code:
function viewQuestion()
    {
        $data['title'] = "Question View";
        $data['heading'] = "Question View";
        
        $urlSegment = $this->uri->segment(3);

        $query = $this->db->query('SELECT * FROM test WHERE ques_num = "$urlSegment"');
        $data['question'] = $query->result(); // or result_array()

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


and a bit of my view file looks like this:

Code:
<p>&lt;?=$question->question?&gt;</p>
<ol>
  <li>&lt;?=$question->ans_1?&gt;</li>
  <li>&lt;?=$question->ans_2?&gt;</li>
  <li>&lt;?=$question->ans_3?&gt;</li>
  <li>&lt;?=$question->ans_4?&gt;</li>
</ol>

I have tried taking the uri segment variable out, and making it a "hard number." Yes, the number I entered is in the database =) but, I'm not getting anything. No errors, and no dynamic info. The "static" code in my view file shows up, but nothing the controller is trying to feed to it from the db.

Thanks again,

-greg


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, 11:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB