|
Posted by Gary Smith on 08/13/05 02:18
Hi Amanda,
Try this:
$query ="SELECT * FROM projects WHERE parent_project_id is NULL OR
parent_project_id = ''";
$projects = $db->getAssoc($query, DB_FETCHMODE_ASSOC);
foreach ($projects as $key => $project) {
if (!empty($project['project_id'])){
$id = $project['project_id'];
$query ="SELECT * FROM projects WHERE project_id = ? ";
$sub = $db->getAssoc($query, false, array($id));
$projects[$key]['subs'] = $sub;
}
}
$tpl->assign('projects', $projects);
Gary
in article 42FCF52F.9040707@indiana.edu, Amanda Hemmerich at
ahemmeri@indiana.edu wrote on 8/12/05 9:14 AM:
> $query ="SELECT * FROM projects WHERE parent_project_id is NULL OR
> parent_project_id = ''";
>
> $projects = $db->getAssoc($query, DB_FETCHMODE_ASSOC);
>
> foreach ($projects as $key => $project) {
> if (!empty($project[$key]['project_id'])){
>
> $id = $project[$key]['project_id'];
> $query ="SELECT * FROM projects WHERE parent_project_id = ? ";
>
> //$sub = $db-> getAssoc($query, false, array($id));
> //$projects[$key]['subs'] = $sub;
> }
> }
>
> $tpl->assign('projects', $projects);
Navigation:
[Reply to this message]
|