i am getting the values from the database table as an array like cusomer name, years, complaints.
cusomer names as rows and years as columns. complaints as values. all values are geeting from the db table.
xys cusomer in 2008 has 10 complaints
and abc cusomer in 2009 has 15 complaints and
asdf cusomer in 2010 has 20 complaints
like that i want display. give some. i am not good at arrays. please help to me.
Regards,
qumar.
how to declar the 2 dimentional array php
Moderator: General Moderators
Re: how to declar the 2 dimentional array php
The easiest way would be to simply initialize arrays within arrays, like:
Then you can access them like:
Code: Select all
$allComplaints = array(
'2008', array($complaint1, $complaint2, ...),
'2009', array($complaint1, $complaint2, ...),
...
);Code: Select all
$aComplaint = $allComplaints['2008'][0];