 |
BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
 | This is the forum to discuss the Wrox book Professional CodeIgniter by Thomas Myer; ISBN: 9780470282458 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 16th, 2009, 05:36 AM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Get error Severity: Notice Message: Uninitialized string offset: 0
Hi Thomas,
very good book, but with many errors.
Till now I solved errors by myself, but this one I don't have any idea that to do:
A PHP Error was encountered
Severity: Notice
Message: Uninitialized string offset: 0
Filename: views/admin_cat_home.php
Line Number: 14
Please help.
Thanks
|
|

June 16th, 2009, 11:27 AM
|
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
|
|
I think most of errors of the claudias sample codes coming from that the codes were written for error reporting E_ALL & ~E_NOTICE. But the index.php set up the error reporting as E_NOTICE.
If the author reset the index.php error reporting as E_ALL & ~E_NOTICE. Most of the errors will be gone.
This leads to my another question, should we program for error proof as error reporting E_ALL or for error proof as error reporting E_ALL & ~E_NOTICE?
Go back to your issue, I am not sure, but if your try to reset error reporting to "E_ALL & ~E_NOTICE", my guess is that error will be gone.
By the way, did you empty the categories table and then this error pop up?
|
|

June 16th, 2009, 11:34 PM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I already solved the issue, and put the solution here(some why is deleted now).
The issue is some problems in code(maybe even with CI because query from controller was bringing wrong results-very strange ). I replaced ->get_array with ->result() and loop content. Now working correct.
New code:
function getAllCategories()
{
$data=array();
$Q=$this->db->get('categories');
if($Q->num_rows() > 0){
foreach($Q->result() as $row){
$data[]= array(
'id'=>$row->id,
'name'=>$row->name,
'shortdesc'=>$row->shortdesc,
'longdesc'=>$row->longdesc,
'status'=>$row->status,
'parentid'=>$row->parentid
);
}
}
$Q->free_result();
//check
return $data;
}
|
|

June 17th, 2009, 02:13 AM
|
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
|
|
That is strange. result_array() or result(), it shouldn't make any difference here.
Cannot repeat the error you have either.
Last edited by blackhorse66; June 17th, 2009 at 02:20 AM..
|
|

June 17th, 2009, 05:10 AM
|
|
Registered User
|
|
Join Date: Jun 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Generally you right,but it was very strange thing.
result_array() was giving me wrong result, maybe because it was trying extract multidimensional array from row to another array and in some way do it wrong. In repaired code I create multidimensional array before pass values.
|
|

June 17th, 2009, 10:39 PM
|
|
Wrox Author
|
|
Join Date: May 2008
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
bizarre
Quote:
Originally Posted by grgr07
Generally you right,but it was very strange thing.
result_array() was giving me wrong result, maybe because it was trying extract multidimensional array from row to another array and in some way do it wrong. In repaired code I create multidimensional array before pass values.
|
That's....bizarre. The two should be aliases for one another.
__________________
Thomas Myer
Author, Professional CodeIgniter
http://www.tripledogs.com
|
|

June 17th, 2009, 10:41 PM
|
|
Wrox Author
|
|
Join Date: May 2008
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
i feel you
Quote:
Originally Posted by grgr07
Hi Thomas,
very good book, but with many errors.
Till now I solved errors by myself, but this one I don't have any idea that to do:
A PHP Error was encountered
Severity: Notice
Message: Uninitialized string offset: 0
Filename: views/admin_cat_home.php
Line Number: 14
Please help.
Thanks
|
yes, we had some last minute changes go into the book which resulted in some mismatches between text examples in the book and actual code on the CD, which has been a bit frustrating for me.....again, I apologize for the mixups.
__________________
Thomas Myer
Author, Professional CodeIgniter
http://www.tripledogs.com
|
|
 |