function get_list($parent = 0) { global $db; try { $loginsQuery = $db->prepare("SELECT * FROM agentLogins WHERE parent = :parent ORDER BY itemId"); $loginsQuery->execute(array(':parent' => $parent)); } catch (PDOException $e) { exit("error in query"); } $table = $loginsQuery->fetchAll(PDO::FETCH_ASSOC); foreach ($table as $key => $row) { $table[$key]['children'] = agent_logins::get_list($row['itemId']); } return $table; }
<input type="hidden" name="parent_id" value="' . $parent . '"> <input onfocus="clear_default_message(this);" type="text" style="width:280px" name="label" value="Leave this box blank to not display the colon ->"> : <input type="text" name="value"> <input type="submit" name="add_child" value="Add"> <input type="submit" name="cancel" value="Cancel"> </form> </li>'; } else { if ($auth == 1 && !$toplevel) { echo '<li class="ghost_link"><span class="editable" onclick="add_list_item(' . $parent_id . ')">Click to add another item here</span></li>'; } } echo "</ul>\n"; } $list = agent_logins::get_list(); ?> <title>Agent Logins</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <?php if ($auth == 1) { ?> <style type="text/css"> span.editable { cursor: pointer; } li.ghost_link, ul.ghost_link, span.ghost_link {