src/snac/server/database/SQL.php
/**
     * Select all user row id values from database
     *
     * If we have a non-null, non-empty $affiliationID then constrain the query to only return users
     * associated with that institution.
     *
     * Paremeters are not optional. The calling code needs to pass both params, and must use some logic to
     * determine what param values need to be passed.
     *
     * @param boolean $everyone True to return all users active and inactive. False to return active only.
     *
     * @param integer $affiliationID If non-null (true in any php sense of true), constrain on this
     * affiliation ID.
     *
     * @return integer[] Array of row id integer values.
     */
Select all user row id values from database
If we have a non-null, non-empty $affiliationID then constrain the query to only return users
associated with that institution.

Paremeters are not optional. The calling code needs to pass both params, and must use some logic to
determine what param values need to be passed.

@param boolean $everyone True to return all users active and inactive. False to return active only.

@param integer $affiliationID If non-null (true in any php sense of true), constrain on this
affiliation ID.

@return integer[] Array of row id integer values.
Select all user row id values from database If we have a non - null non - empty $affiliationID then constrain the query to only return users associated with that institution . Paremeters are not optional . The calling code needs to pass both params and must use some logic to determine what param values need to be passed . @param boolean $everyone True to return all users active and inactive . False to return active only . @param integer $affiliationID If non - null ( true in any php sense of true ) constrain on this affiliation ID . @return integer [] Array of row id integer values .
public function selectAllUserIDList($everyone, $affiliationID)
    {
        $activeClause = "";
        if ($affiliationID)
        {
            if (! $everyone)
            {
                $activeClause = " active and ";
            }
            $query = "select id from appuser where $activeClause affiliation=$1";
            $result = $this->sdb->query($query, array($affiliationID));
        }
        else
        {
            if (! $everyone)
            {
                $activeClause = " where active";
            }
            $query = "select id from appuser $activeClause";
            $result = $this->sdb->query($query, array());
        }
        $all = array();
        while($row = $this->sdb->fetchrow($result))
        {
            array_push($all, $row['id']);
        }
        return $all;
    }
public function selectAllUserIDList ( $ everyone , $ affiliationID ) { $ activeClause = " " ; if ( $ affiliationID ) { if ( ! $ everyone ) { $ activeClause = "  active and  " ; } $ query = " select id from appuser where  $ activeClause  affiliation=$1 " ; $ result = $ this -> sdb -> query ( $ query , array ( $ affiliationID ) ) ; } else { if ( ! $ everyone ) { $ activeClause = "  where active " ; } $ query = " select id from appuser  $ activeClause " ; $ result = $ this -> sdb -> query ( $ query , array ( ) ) ; } $ all = array ( ) ; while ( $ row = $ this -> sdb -> fetchrow ( $ result ) ) { array_push ( $ all , $ row [ 'id' ] ) ; } return $ all ; }
Select all user row id values from database
 If we have a non-null, non-empty $affiliationID then constrain the query to only return users
 associated with that institution.
Select all user row id values from database If we have a non - null non - empty $affiliationID then constrain the query to only return users associated with that institution .
/*
         * $vars are interpolated in "" strings. $1 is not interpolated.
         *
         * Yes, we are building a sql query via string interpolation. We are not using any outside data, so
         * there's no risk of sql injection.
         *
         * $affiliation really needs to be a greater than zero integer, so we could test for is_int() && >
         * zero which might be better (more specific).
         */