Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Incomplete arrays passed from controller to view in Codeigniter

Posted on 2014-03-01
8
Medium Priority
?
483 Views
Last Modified: 2014-03-01
I have a Codeigniter application that is not receiving complete data in the view.

I have a report function in my controller that calls the model to create an array to pass to my view.

The array looks complete when I var_dump it in the model however it is truncated in the view is there a constraint or limit that I have not set or being imposed on the length of parameters?

Thank you

John
0
Comment
Question by:johnecollins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 39896925
Can you post your code?
0
 

Author Comment

by:johnecollins
ID: 39896932
Thanks Loganathan,

Here it comes ;-)
0
 

Author Comment

by:johnecollins
ID: 39896956
Loganathan,

The Controller, the model, the view and the output

Looking at the output in the controller it doesn't display the array in full

But in the view it says Undefined table data ;-(

Thanks for looking

John
books.php
Books-model.php
books-main.php
The-output.docx
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 44

Accepted Solution

by:
Chris Stanyon earned 2000 total points
ID: 39897211
The table->generate() method takes an array or database result as an argument and produces the HTML for your table.  In your books model you have a method called getAll() which queries the database and then calls the table->generate() method. This creates the HTML for the table and returns it to your controller. You then assigns that to $data['table'];

In your view, the $table variable holds the HTML for the table. You are trying to call the table->generate() method again in the view, but this time you're passing in the already generated HTML, which is causing the error

If you want to display your table, then in your view just echo $table.
0
 

Author Closing Comment

by:johnecollins
ID: 39897315
Hi Chris,

Thanks very much for your effort, you couldn't pm your phone number could you  save me putting up questions ;-)

500 well earned points
Cheers

John
0
 
LVL 44

Expert Comment

by:Chris Stanyon
ID: 39897334
Thanks for the points :)

No go on the phone number - I don't always have the time to work on EE stuff, so by keeping it all within EE allows me to dip in and out when I have the time.

Besides, posting a question on here will get a good mix of experts to help you out.
0
 

Author Comment

by:johnecollins
ID: 39897583
Chris,

Cheers but if you see me in a pub I'll happily buy you a pint of beer ;-)

Thanks a lot

John
0
 
LVL 44

Expert Comment

by:Chris Stanyon
ID: 39897607
Sounds good :)
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question