and yes, I have looked at many examples and have actually found something that works.... kind of.
I am trying to display an hierarchical menu.
To save som DB transactions, I will read every menu item into an array. Offcource, this has to be an multidimensional array to work (I think).
I have 109 records in my database.
Here's the code
$result = @mysql_query('SELECT _ID, _Parent, MenuName FROM ws_menustructure') or die (mysql_error());
$tempArray = array( array (Parent), array (MenuName) );
$i = 0;
while ($row = mysql_fetch_assoc($result))
{
$tempArray[i]['Parent']= $row['_Parent'];
$tempArray[i]['MenuName']= $row['MenuName'];
echo $tempArray[i]['MenuName'].'<br>'; // Gr8t. Prints out all 109 menu items.
$i++;
}
echo 'Da size is: '.sizeof($tempArray); // Grrrrr!!!! The count is 3!!!!
This works but it takes 7 seconds!
Localy from my computer!!!
And the size of the tempArray is 3????? 😕
Am I using multidimensional arrays the wrong way?
Cheers!