0

I'm using this :

$users = $this->user_model->get_all_users();

Here $users is an indexed array.

Currently I am doing like following by making it to associative array and the passing to view so that we can use access that with the variable named with the key.

$data = array('json_users' => $users);

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

how to do this without making the indexed array to associative array ?

1
  • directly pass the $users to the view., but it will rewrite other data you only get 1 result. You can't do it without renaming the other with different name. Commented Oct 17, 2013 at 10:54

1 Answer 1

0

You can't, that's the only way to do it.

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

1 Comment

To whoever downvoted me - "there's no other way" is not a bad answer if that's true. And if it wasn't true, you'd be able to give a different answer which obviously is not the case.

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.