<?php include_once '../functions.php'; checklogin(); $conn = opendb(); if ($loggedin == 1) { $account = sanitise('id'); $archive = sanitise('archive'); checkAccount($user, $account, 0); $query = "UPDATE accounts SET Archived='{$archive}' WHERE AccountID='{$account}'"; mysql_query($query) or die(mysql_error()); $query = "SELECT * FROM accounts WHERE AccountID='{$account}'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_assoc($result); accountInList($row['AccountID'], $row['AccountName'], $archive); }
function accountList($user) { $query = "SELECT * FROM accounts WHERE UserID='{$user}' ORDER BY AccountName ASC"; $result = mysql_query($query) or die(mysql_error()); echo "<table>"; while ($row = mysql_fetch_assoc($result)) { echo "<tr id='account" . $row['AccountID'] . "'>"; accountInList($row['AccountID'], $row['AccountName'], $row['Archived']); echo "</tr>"; } }