0

Controllers

function view_question(){

    $data['title'] = "Admin | View Question";
    $data['base_url'] = base_url();

    $viewQuestion = $this->questions->view_question();
    $data['question_set'] = $viewQuestion;

    $this->load->view("admin/admin_question_view",$data);

}

View

<?foreach ($question_set as $b):?>
        <?php 
        var_dump($b);
        die();?>
        <center> bla bla bla ..

and I got this error message

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: b

It's work fine in localhost but when I move to server it's got problems

so I try to add $data['b'] = array(); in controller but it's not work

var_dump($b) got this

array(0) { }

After I check PHP version on server it's different for server; PHP Version 5.2.6 for localhost; PHP Version 5.3.1.

It's possible about PHP version ?

Any idea ?

1
  • make sure you get data back when you do $this->questions->view_question() Commented Nov 20, 2011 at 13:08

1 Answer 1

1

Do you still get data if you just do

print_r($question_set);

Or perhaps short tags are off? Try using

<?php ?> 

everywhere instead?

Sign up to request clarification or add additional context in comments.

1 Comment

Ok Thanks PHP Version 5.2.6 have problems with <? ?> php short tag

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.