I’m wishing for a simple index more or less with my PHP note taking software, each note has a “language” field for the programming language its written in. When I iterate through each entry in a while loop, I’m not sure how i’d list categories of them such as:
PHP:
Note 1
Note 5
SQL:
Note 2
Note 3
Do I need to place all entries in a temporary array with ifs, like this?
if($field['language'] == "PHP")
$PHPsection[] = $field;
Although that doesn’t look the best as I’d need to hardcode each section.. I’m stuck.
you could group already in the database.
or sort by section and then iterate through and output the proper seperation code when the section changes. a temporary array is also a solution. given your example code maby this can point you in one possible directino (altough the temporary array is of course not an elegant solution but if the data is not that much it doesnt really matter)