Posted by Garrie (Garrie), 20 November 2002I am getting the following error message, but I don't understand how it is being caused. Can anyone help?
Notice: Uninitialized string offset: 7 in E:\CMIS\HTML\KCL\PHP\TTGrid.php on line 30
Posted by admin (Graham Ellis), 21 November 2002Well ... I cut and pasted the code, added a <?php onto the start, and ran it (from the command line). Came up with a whole swathe of HTML table tags bit - dorry - no error or warning messages. I also tried to cut out a few lines of code where I anticipated the error occurred (around line 30) and run just that snippet of code - again, no problems ...
The error message looks as if you are using a string as if it was an array to get at certain characters in that string - a valid thing to do in PHP. It would indicate to me that you're looking for position 7 of something that only has 7 positions, which would be numbered 0 to 6. Suspisions fell on $weekDay and on $hour, both of which have a constart "7" in there.
I'm really only rolling the evidence here; can't see anything obvious and since I can't reporduce the problem I have nothing to solve - it's like a murder without a body. Garrie - have a look at the thoughts above and see if they help. If not, see if you can tie the problem down to a few lines of code anr repost, also letting me know the platform and PHP version that you're using, and I'll have a further more targetted look.
Posted by Garrie (Garrie), 21 November 2002on 11/21/02 at 06:47:02, Graham Ellis wrote:
The thing is I'm not! I'm using an array as an array.
Webserver = BadBlue 1.7 (http://www.badblue.com/)
Posted by admin (Graham Ellis), 21 November 2002Yes, I know you're not! Odd one at first glance!!
I'm kinda stuck on this one as I don't get the error message - but then I'm running 4.1.2 on most of my systems to maintain compatability for older scripts and to mirror the ISP we use.
I would suggest that you take a copy of the whole script, then keep knocking out chunks so that you can reproduce it in a smaller bit of code - I can see nothing that's obviusly wrong at about line 30, which is where it's reporting the problem, but it could be some other effect / way that a variable is initialised or something.
I would also be tempted to switch $weekDay to have elements 0 to 6 rather than 1 to 7, adjust the rest of the code accordingly, and see if the error report goes away (IMHO there's a slim but worthwhile chance that it will), changes to report "6" or stays reporting "7".
Sorry that it's back to research but that's how it goes!
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho