By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,718 Members | 1,438 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,718 IT Pros & Developers. It's quick & easy.

PHP array problem

P: n/a
Hi all,

i'm having a problem concerning arrays. I am using an array that is stored
in a mysql dbase. First i store this array in a variable like:

$array2 = $array1

$array1 contains: "2" => "25", "21" => "1100", "111" =>"25", "" => "", "" =>
"", "" => "", "" => "", "" => "", "" => "", "" => "", "" => "", "" => ""

After that:

$array1 = array($array2);
foreach ($array1 as $index => $data){
echo $index." aantal: ".$data."<br>";
}

What I see in the browser is:

0 aantal: "2" => "25", "21" => "1100", "111" =>"25", "" => "", "" => "", ""
=> "", "" => "", "" => "", "" => "", "" => "", "" => "", "" => ""

When I just copy the array string into the array() everything is fine and
the browser shows:

2 aantal: 25
21 aantal: 1100
111 aantal: 25

How can I use the variable and still get the list as a result in the
browser???

Thanks in advance,

Martijn
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I noticed that Message-ID: <bn**********@reader08.wxs.nl> from Martijn
contained the following:
2 aantal: 25
21 aantal: 1100
111 aantal: 25

How can I use the variable and still get the list as a result in the
browser???


Why not just get the information directly from the database via a query?

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2

P: n/a
> Why not just get the information directly from the database via a query?

Hi Geoff, I get more arrays from the database and join them to get one big
array. This big array is $array2
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.