Example #1
0
 public static function getVideos($id, $artist_id)
 {
     if (!MyUtil::isInteger($id) || $id < 0) {
         $id = 0;
     }
     if (!MyUtil::isInteger($artist_id) || $artist_id < 0) {
         $artist_id = 0;
     }
     $stm = " SELECT id, artist_id, session_id, name, description, \n\t\t\t\t\t\tyoutube_id, iframe_url, votes, upload_status_nbr, \n\t\t\t\t\t\tvideo_status_nbr, regexp_replace(file, '/home1/enderrac/public_html/spiresessions/', 'http://www.spiresessions.com/') as file, is_active FROM " . self::$table_name . " WHERE (id = {$id} OR 0 = {$id}) " . "  AND (artist_id = {$artist_id} OR 0 = {$artist_id})";
     $result = ConnDB::query_db($stm);
     if (!$result) {
         return MyUtil::fnOk(false, "SQL Error", null);
     }
     $retArray = [];
     while ($row = pg_fetch_assoc($result)) {
         array_push($retArray, $row);
     }
     if (sizeof($retArray) > 0) {
         return MyUtil::fnOk(true, "Videos Found", $retArray);
     } else {
         return MyUtil::fnOk(false, "No Results", $retArray);
     }
 }