I am loosing my mind. Long nights and have eroded my brain power any help on this would be greatly appreciated. Okay I have this script that allows people to select check boxes for different options.
I am currently pulling the check boxes as a group and assigning the results to an associative array to display the items in a html template.
Basically template out put looks like this.
Option:
Check box 1
Check box 2
Check box 3
Now there is a I have a column in the database for categories of the options, and I cannot figure out how to order them by, and display the name of the options category. I am trying to get my output to look like this:
Option:
Category 1
Check box 1
Check box 1
Check box 1
Category 2
Check box 2
Check box 2
Check box 2
Category 3
Check box 3
Check box 3
Check box 3
The database looks like this.
id title parent
1 Blue Colors 0
2 Dark Blue 1
3 Red Colors 0
4 Light Red 3
Categories have and id of 0 and the options have the parent id.
Here is the code.
$catresult = $db->sql_query("SELECT * FROM load_sets WHERE parent = '0'");
while ($parent_result = $db->sql_fetchrow($catresult))
{
$child = $db->sql_query("SELECT * FROM color_sets WHERE parent = '".$parent_result['id']."'ORDER BY title ASC");
while ($children = $db->sql_fetchrow($child))
{
$temp->assign_vars('colors', array(
'SS_TITLE' => ''.$children['title'].'**',
'SS_VALUE' => $children['title'],
'SP_TITLE' => ".$parent_result['title'].'**',
));
}