function get_blog_posts($max_num_posts, $offset = 0) { $body_posts_query = <<<SQL select bp.blog_post, bp.title, bp.body, to_char( bp.created, 'Day, Month DD, YYYY HH:MI:SS AM' ) as created, m.first_name || ' ' || m.last_name as author, r.name as role, me.first_name || ' ' || me.last_name as editor, to_char( bp.edited, 'Day, Month DD, YYYY HH:MI:SS AM' ) as edited, re.name as editor_role from tb_blog_post bp join tb_member m on bp.creator = m.member join tb_member_role mr on m.member = mr.member join tb_role r on mr.role = r.role left join tb_member me on bp.editor = me.member left join tb_member_role mre on me.member = mre.member left join tb_role re on mre.role = re.role order by bp.blog_post desc limit ?limit? offset ?offset? SQL; $params = ['limit' => $max_num_posts, 'offset' => $offset]; $result = query_execute($body_posts_query, $params); return query_success($result) ? query_fetch_all($result) : false; }
function get_officer_info($role) { $get_officer_info_query = <<<SQL select m.member, m.first_name || ' ' || m.last_name as officer_name, m.display_email_address from tb_member m join tb_member_role mr on m.member = mr.member join tb_role r on mr.role = r.role where r.role = ?role? SQL; $params = ['role' => $role]; $result = query_execute($get_officer_info_query, $params); // query_fetch_all because there may be more than one officer per position return query_success($result) ? query_fetch_all($result) : false; }