function getAllMembersOfARole($roleId) { $userList = array(); // connect to db $dbInfo = initialize_db_info(); $dbLink = db_connect($dbInfo); db_select($dbLink, $dbInfo); $sql = generateAllMembersOfARoleListSql($roleId); //var_dump($sql); $result = mysql_query($sql, $dbLink); if ($result) { if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $oneUser = createUserFromRow($row); $userList[] = $oneUser; } } } return $userList; }
function getAllUsersSortedByName() { // connect to db $dbInfo = initialize_db_info(); $dbLink = db_connect($dbInfo); db_select($dbLink, $dbInfo); $getAllUsersSql = "SELECT * FROM login ORDER BY last_name, first_name"; $result = mysql_query($getAllUsersSql, $dbLink); if (!$result) { //echo $findUserByEmailSql; throw new Exception('no results'); } $row = mysql_fetch_assoc($result); while ($row) { $oneUser = createUserFromRow($row); $userList[] = $oneUser; $row = mysql_fetch_assoc($result); } return $userList; }