Example #1
0
 public function DeleteSeries($series_id)
 {
     //DELETE ENTRY FROM POOL SERIES TABLE:
     $query = new DB_Queries();
     $delete_array = $this->CreateArrayFromDB_QueryInputs('Pool Series', 'Series ID', $series_id);
     $return_variable = $query->DeleteFromDB($delete_array);
     return $return_variable;
     //NOTE, MAY WANT TO WRITE ADDITIONAL CODE IN THIS METHOD TO DELETE POOLS ASSOCIATED WITH SERIES?  MAY NOT WANT TO AS WELL...  LEAVING THIS FOR NOW (9/7/14)
 }
Example #2
0
 public function GetFriends($user_id)
 {
     include_once 'inc/class.pool.inc.php';
     $query = new DB_Queries();
     $pool = new Pool();
     $users_pools_query = "SELECT `Pool ID` FROM  `Pool Membership` WHERE `User ID` = '{$user_id}';";
     $result = mysqli_query($this->cxn, $users_pools_query);
     $return_array = array();
     while ($row = mysqli_fetch_assoc($result)) {
         //for each pool that a user is in:
         $pool_id = $row['Pool ID'];
         $pool_member_query = "SELECT `User ID` FROM  `Pool Membership` WHERE `Pool ID` = '{$pool_id}';";
         $result2 = mysqli_query($this->cxn, $pool_member_query);
         while ($row_user_id = mysqli_fetch_assoc($result2)) {
             //for each user that is in the given pool
             $user_id = $row_user_id['User ID'];
             $select_array3 = $pool->CreateArrayFromDB_QueryInputs('Email Address', 'TABLE:', 'User', 'User ID', $user_id);
             $email_array = $query->SelectFromDB($select_array3);
             $return_array[$user_id] = $email_array['Email Address'];
         }
     }
     return $return_array;
 }
Example #3
0
 public function GetPoolsInSeries($series_id, $ended = NULL)
 {
     $query = new DB_Queries();
     //new instance of the DB_Queries object
     $select_array = $this->CreateArrayFromDB_QueryInputs('*', 'TABLE:', 'Pool', 'Series ID', $series_id);
     if (!is_null($ended)) {
         //if the $ended parameter was passed to the method, we add a "WHERE 'Pool Ended?' = " parameter onto the SQL statement:
         $select_array[] = 'Pool ended?';
         if ($ended == 0) {
             //if we want to pull only pools that have not already ended:
             $select_array[] = 0;
         } else {
             //if we want to pull only pools that have ended
             $select_array[] = 1;
         }
     }
     $result = $query->SelectFromDB($select_array);
     $list_of_pools = array();
     $result_type = gettype($result);
     if ($result_type == "array") {
         //if only one pool series is found (meaning $result is just an associative array for the single pool series and not a mysqli object)
         $list_of_pools[$result['Pool ID']] = $result;
         //store pool series data in list_of_series variable with the series ID as the array key
     } else {
         //if more than one pool series is found (meaning $result is a mysqli object, not an associative array)
         //store all of the found series info in list_of_series array:
         while ($row = mysqli_fetch_assoc($result)) {
             $pool_id = $row['Pool ID'];
             //get info of pool for given series id:
             $select_pool_info_array = $this->CreateArrayFromDB_QueryInputs('*', 'TABLE:', 'Pool', 'Pool ID', $pool_id);
             $result2 = $query->SelectFromDB($select_pool_info_array);
             $list_of_pools[$pool_id] = $result2;
             //store series info into the list_of_series array
         }
     }
     return $list_of_pools;
 }