Reply to Re: "Array to String Conversion" error when constructing a multi-dimensional array

Your name:

Reply:


Posted by drako on 01/18/07 16:46

Sorry, the extra line of code above should have read:

if(isset($_SESSION["increment"])) {$x =
count($_SESSION["increment"]);}

I just noticed the typo, in case anyone has been sharp enough to spot
it...


drako wrote:
> You are correct in assuming that I chopped out a line when I posted
> this...
>
> The missing line between '$x=0' and
> '$_SESSION["increment"][$x]=array(...)'.
>
> is
>
> if(isset($_SESSION["increments"])) {$x =
> count($_SESSION["increments"]);}
>
> The purpose is to count the number of entries in the array - if count
> returns '5', then the last value of $x would have been 4, so we can
> assign '5' as the next value in the array.
>
> Could this be the offending line...
>
>
>
> Toby Inkster wrote:
> > drako wrote:
> >
> > > I'm sure that there is a pretty simple mistake lurking somewhere - I
> > > just can't seem to figure it out.
> > >
> > > Any suggestions or hints ?
> >
> > There doesn't seem to be anything wrong with the code you posted (except
> > for a missing semicolon after $x = 0), so I suspect the problem lies
> > somewhere in your other code.
> >
> > Because of this missing semicolon, I suspect you have chopped out a
> > section of code between '$x=0' and '$_SESSION["increment"][$x]=array(...)'.
> > That is almost certainly where your problem lies. In particular, I think
> > you may have assigned some non-integer value to $x at some point.
> >
> > Do 'print_r($x);' just before the error happens and see what you see.
> >
> > --
> > Toby A Inkster BSc (Hons) ARCS
> > Contact Me ~ http://tobyinkster.co.uk/contact

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация