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

Your name:

Reply:


Posted by Curtis on 01/20/07 14:42

On Jan 19, 5:15 am, "Rik" <luiheidsgoe...@hotmail.com> wrote:
> drako wrote:
> > OK,
>
> > Here is the code in its entireity:
>
> > [It is wrapped around an IF statement to process upon a certain
> > condition].
>
> > if($_POST['increment'] == 1) {
>
> > $x = 0;
>
> > if(isset($_SESSION["increment"])) {$x =
> > count($_SESSION["increment"]);}
>
> > $_SESSION["increment"][$x] = array("increment_bond" =>
> > $_POST["increment_bond"],
> > "increment_amount" => $_POST["increment_amount"],
> > "increment_comm_date1" => $_POST["increment_comm_date1"],
> > "increment_comm_date2" => $_POST["increment_comm_date2"],
> > "increment_comm_date3" => $_POST["increment_comm_date3"]);
>
> > }Is your $_SESSION['increment'] accessed/altered anywhere else in the
> script? Check for it.
> Also, add this before "if($_POST['increment'] == 1)":
>
> if(isset($_SESSION['increment'])) var_dump($_SESSION['incremenet']);
>
> Most likely, you overwrite the $_SESSION['increment'] somewhere else in
> your code, so it get's cast to a string. Check your code for every
> '$_SESSION['increment']= ', and carefully consider the return of the
> function after it...
> --
> Rik Wasmus

Concerning your earlier post, great deductive reasoning, Rik. *bows*

Just to reiterate to the OP, you need to check if you're assigning
$_SESSION['increment'] a function's return value, or possibly even
directly a string, at some other point (potentially in a different
file, since it is a session variable).

Also, you could a foreach loop, so as not to manually maintain the
array's index.
---
Curtis

[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

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