Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8
|
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
 
Old June 16th, 2009, 05:36 AM
Registered User
 
Join Date: Jun 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old June 16th, 2009, 11:27 AM
Authorized User
Points: 133, Level: 2
Points: 133, Level: 2 Points: 133, Level: 2 Points: 133, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2009
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default

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?
 
Old June 16th, 2009, 11:34 PM
Registered User
 
Join Date: Jun 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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;
}
 
Old June 17th, 2009, 02:13 AM
Authorized User
Points: 133, Level: 2
Points: 133, Level: 2 Points: 133, Level: 2 Points: 133, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2009
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Default

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..
 
Old June 17th, 2009, 05:10 AM
Registered User
 
Join Date: Jun 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old June 17th, 2009, 10:39 PM
Wrox Author
 
Join Date: May 2008
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
Default bizarre

Quote:
Originally Posted by grgr07 View Post
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
 
Old June 17th, 2009, 10:41 PM
Wrox Author
 
Join Date: May 2008
Posts: 53
Thanks: 0
Thanked 5 Times in 5 Posts
Default i feel you

Quote:
Originally Posted by grgr07 View Post
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
undefined offset error trev Beginning PHP 9 January 24th, 2007 04:41 AM
Notice: Undefined offset: ## Herjan BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 November 27th, 2005 12:29 PM
Loops and Arrays - Undefined offset notice dkintheuk Beginning PHP 6 September 12th, 2005 11:38 PM
ERROR : 5180, Severity:22, State:1 ckentebe SQL Server 2000 1 July 20th, 2004 01:47 AM
Query String Too Long....Max Length Error Message phungleon Classic ASP Databases 14 May 28th, 2004 12:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.