You are here: Re: "Array to String Conversion" error when constructing a multi-dimensional array « PHP Programming Language « IT news, forums, messages
Re: "Array to String Conversion" error when constructing a multi-dimensional array

Posted by drako on 01/17/07 20:50

OK,

I inserted the debugging statements as you suggested:


$_SESSION["increment"] = array();
echo '1: ';print_r($_SESSION["increment"]);echo '<br>';

$x = 0 // Counter - This will be
incremented
echo '2: ';print_r($increment); echo '<br>';


$_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"]);

echo '3: ';print_r($_SESSION["increment"]);exit;

<------->
The output is:

1: 1
2:
3: 1A


I'm still no wiser as to what is going on here....

Rgds
Neil.


Heiko Richler wrote:
> drako wrote:
> > Hi,
> >
> > I'm a bit stumped as I am getting a "Notice: Array to String
> > Conversion" error when trying to do something that on the surface
> > should be a very simple task - create an array, and write a set of
> > values to them based on data submitted from POST Fields.
> >
> > Code below:
> >
> > $_SESSION["increment"] = array();
>
> Try doing <?php print_r($_SESSION["increment"]); ?> here ... (*)
>
> > $x = 0 // Counter - This will be
> > incremented
>
> (*) do you have any code in here?
> What does <?php print_r($increment); ?> tell you?
>
> (*) ... and an other <?php print_r($_SESSION["increment"]); ?> here.
>
> > $_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"]);
>
> Heiko
> --
> http://portal.richler.de/ Namensportal zu Richler
> http://www.richler.de/ Heiko Richler: Computer - Know How!
> http://www.richler.info/ private Homepage

 

Navigation:

[Reply to this 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

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