i have an array of categories which i query the database with via a foreach
within the for each i want to build new arrays (multidimesional) named after the parts of the category array.
i've tried $$v where $v is the value of the array this works but rewrites each time through.
$$v [] gives me Fatal error: Cannot use [] for reading in !@£/$%/&*.php on line 13
$cats = array('system', 'archive', 'hire', 'install', 'gallery', 'contact');
foreach ($cats as $k => $v)
{
echo $sql = 'SELECT `title` , `name` FROM `pt_core_wwwpages` WHERE `category` = "'.$v.'"';
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
$$v = array($row[0],$row[1]); // this works
$$v [] = array($row[0],$row[1]); // this is erroneous
}
}
any pointers where i may be going wrong?
or is there an overall better aproach to this issue?
advance thanks