public static function search()
 {
     $SELECT = 'SELECT p.phone_id, p.nazwa, g.filename FROM phone p, galeria g WHERE p.phone_id = g.phone_id AND ';
     $questions = json_decode($_COOKIE['questions']);
     for ($i = 0, $c = count($questions); $i < $c; $i++) {
         if ($questions[$i] != null) {
             switch ($i + 1) {
                 case 1:
                     $price = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($price, "cena");
                     break;
                 case 2:
                     $SELECT .= "p.rodzaj = " . $questions[$i] . " AND ";
                     break;
                 case 3:
                     $SELECT .= "p.system = " . $questions[$i] . " AND ";
                     break;
                 case 4:
                     $display = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($display, "p.wyswietlacz");
                     break;
                 case 5:
                     $procesor_takt = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($procesor_takt, "p.procesor_takt");
                     break;
                 case 6:
                     $SELECT .= "p.procesor_rdzenie = " . $questions[$i] . " AND ";
                     break;
                 case 7:
                     $ram = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($ram, "p.ram");
                     break;
                 case 8:
                     $pamiec_wew = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($pamiec_wew, "p.pamiec_wew");
                     break;
                 case 9:
                     $bateria = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($bateria, "p.bateria_mah");
                     break;
                 case 10:
                     $aparat = explode('-', $questions[$i]);
                     $SELECT .= Phone::subquery($aparat, "p.aparat_mpx");
                     break;
                 case 11:
                     $SELECT .= "p.wifi = " . $questions[$i] . " AND ";
                     break;
                 case 12:
                     $SELECT .= "p.lte = " . $questions[$i] . " AND ";
                     break;
             }
         }
     }
     $SELECT .= "1 ORDER BY p.nazwa";
     return DB::select($SELECT);
 }