Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $whereClause = array();
- $bindArray = array();
- $county1 = filter_input(INPUT_POST, 'county1', FILTER_SANITIZE_STRING);
- $county2 = filter_input(INPUT_POST, 'county2', FILTER_SANITIZE_STRING);
- $county3 = filter_input(INPUT_POST, 'county3', FILTER_SANITIZE_STRING);
- $county4 = filter_input(INPUT_POST, 'county4', FILTER_SANITIZE_STRING);
- $county5 = filter_input(INPUT_POST, 'county5', FILTER_SANITIZE_STRING);
- $county6 = filter_input(INPUT_POST, 'county6', FILTER_SANITIZE_STRING);
- $bhv = filter_input(INPUT_POST, 'bhv', FILTER_SANITIZE_STRING);
- $mrc = filter_input(INPUT_POST, 'mrc', FILTER_SANITIZE_STRING);
- $general = filter_input(INPUT_POST, 'general', FILTER_SANITIZE_STRING);
- $evv = filter_input(INPUT_POST, 'evv', FILTER_SANITIZE_STRING);
- $allCounties = filter_input(INPUT_POST, 'allCounties', FILTER_SANITIZE_STRING);
- $fillmore = filter_input(INPUT_POST, 'fillmore', FILTER_SANITIZE_STRING);
- $johnson = filter_input(INPUT_POST, 'johnson', FILTER_SANITIZE_STRING);
- $otoe = filter_input(INPUT_POST, 'otoe', FILTER_SANITIZE_STRING);
- $richardson = filter_input(INPUT_POST, 'richardson', FILTER_SANITIZE_STRING);
- $seward = filter_input(INPUT_POST, 'seward', FILTER_SANITIZE_STRING);
- $butler = filter_input(INPUT_POST, 'butler', FILTER_SANITIZE_STRING);
- $gage = filter_input(INPUT_POST, 'gage', FILTER_SANITIZE_STRING);
- $lancaster = filter_input(INPUT_POST, 'lancaster', FILTER_SANITIZE_STRING);
- $pawnee = filter_input(INPUT_POST, 'pawnee', FILTER_SANITIZE_STRING);
- $saline = filter_input(INPUT_POST, 'saline', FILTER_SANITIZE_STRING);
- $thayer = filter_input(INPUT_POST, 'thayer', FILTER_SANITIZE_STRING);
- $cass = filter_input(INPUT_POST, 'cass', FILTER_SANITIZE_STRING);
- $jefferson = filter_input(INPUT_POST, 'jefferspm', FILTER_SANITIZE_STRING);
- $nemaha = filter_input(INPUT_POST, 'nemaha', FILTER_SANITIZE_STRING);
- $polk = filter_input(INPUT_POST, 'polk', FILTER_SANITIZE_STRING);
- $saunders = filter_input(INPUT_POST, 'saunders', FILTER_SANITIZE_STRING);
- $york = filter_input(INPUT_POST, 'york', FILTER_SANITIZE_STRING);
- $aro = filter_input(INPUT_POST, 'aro', FILTER_SANITIZE_STRING);
- $clergy = filter_input(INPUT_POST, 'clergy', FILTER_SANITIZE_STRING);
- $intskills = filter_input(INPUT_POST, 'intskills', FILTER_SANITIZE_STRING);
- $bus = filter_input(INPUT_POST, 'bus', FILTER_SANITIZE_STRING);
- $child = filter_input(INPUT_POST, 'child', FILTER_SANITIZE_STRING);
- $law = filter_input(INPUT_POST, 'law', FILTER_SANITIZE_STRING);
- $cpr = filter_input(INPUT_POST, 'cpr', FILTER_SANITIZE_STRING);
- $data = filter_input(INPUT_POST, 'data', FILTER_SANITIZE_STRING);
- $security = filter_input(INPUT_POST, 'security', FILTER_SANITIZE_STRING);
- $emergency = filter_input(INPUT_POST, 'emergency', FILTER_SANITIZE_STRING);
- $computer = filter_input(INPUT_POST, 'computer', FILTER_SANITIZE_STRING);
- $mechanical = filter_input(INPUT_POST, 'mechanical', FILTER_SANITIZE_STRING);
- $administration = filter_input(INPUT_POST, 'administration', FILTER_SANITIZE_STRING);
- $firstaid = filter_input(INPUT_POST, 'firstaid', FILTER_SANITIZE_STRING);
- $translation = filter_input(INPUT_POST, 'translation', FILTER_SANITIZE_STRING);
- $construction = filter_input(INPUT_POST, 'construction', FILTER_SANITIZE_STRING);
- $basicclean = filter_input(INPUT_POST, 'basicclean', FILTER_SANITIZE_STRING);
- $foodprep = filter_input(INPUT_POST, 'foodprep', FILTER_SANITIZE_STRING);
- $animalcare = filter_input(INPUT_POST, 'animalcare', FILTER_SANITIZE_STRING);
- $heavy = filter_input(INPUT_POST, 'heavy', FILTER_SANITIZE_STRING);
- $license1 = filter_input(INPUT_POST, 'license1', FILTER_SANITIZE_STRING);
- $license2 = filter_input(INPUT_POST, 'license2', FILTER_SANITIZE_STRING);
- $license3 = filter_input(INPUT_POST, 'license3', FILTER_SANITIZE_STRING);
- $license4 = filter_input(INPUT_POST, 'license4', FILTER_SANITIZE_STRING);
- $license5 = filter_input(INPUT_POST, 'license5', FILTER_SANITIZE_STRING);
- $dist1 = filter_input(INPUT_POST, 'dist1', FILTER_SANITIZE_STRING);
- $dist2 = filter_input(INPUT_POST, 'dist2', FILTER_SANITIZE_STRING);
- $dist3 = filter_input(INPUT_POST, 'dist3', FILTER_SANITIZE_STRING);
- $dist4 = filter_input(INPUT_POST, 'dist4', FILTER_SANITIZE_STRING);
- $dist5 = filter_input(INPUT_POST, 'dist5', FILTER_SANITIZE_STRING);
- if(!empty($bhv)){
- $whereClause[] = '`bhv` = :bhv';
- $bindArray[':bhv'] = $bhv;
- } else {
- $bhv = "";
- }
- if(!empty($mrc)){
- $whereClause[] = '`mrc` = :mrc';
- $bindArray[':mrc'] = $mrc;
- } else {
- $mrc = "";
- }
- if(!empty($general)){
- $whereClause[] = '`general` = :general';
- $bindArray[':general'] = $general;
- } else {
- $general = "";
- }
- if(!empty($evv)){
- $whereClause[] = '`evv` = :evv';
- $bindArray[':evv'] = $evv;
- } else {
- $evv = "";
- }
- if(!empty($allCounties)){
- $whereClause[] = '`allCounties` = :allCounties';
- $bindArray[':allCounties'] = $allCounties;
- } else {
- $allCounties = "";
- }
- if(!empty($fillmore)){
- $whereClause[] = '`fillmore` = :fillmore';
- $bindArray[':fillmore'] = $fillmore;
- } else {
- $fillmore = "";
- }
- if(!empty($johnson)){
- $whereClause[] = '`johnson` = :johnson';
- $bindArray[':johnson'] = $johnson;
- } else {
- $johnson = "";
- }
- if(!empty($otoe)){
- $whereClause[] = '`otoe` = :otoe';
- $bindArray[':otoe'] = $otoe;
- } else {
- $otoe = "";
- }
- if(!empty($richardson)){
- $whereClause[] = '`richardson` = :richardson';
- $bindArray[':richardson'] = $richardson;
- } else {
- $richardson = "";
- }
- if(!empty($seward)){
- $whereClause[] = '`seward` = :seward';
- $bindArray[':seward'] = $seward;
- } else {
- $seward = "";
- }
- if(!empty($butler)){
- $whereClause[] = '`butler` = :butler';
- $bindArray[':butler'] = $butler;
- } else {
- $butlet = "";
- }
- if(!empty($gage)){
- $whereClause[] = '`gage` = :gage';
- $bindArray[':gage'] = $gage;
- } else {
- $gage = "";
- }
- if(!empty($lancaster)){
- $whereClause[] = '`lancaster` = :lancaster';
- $bindArray[':lancaster'] = $lancaster;
- } else {
- $lancaster = "";
- }
- if(!empty($pawnee)){
- $whereClause[] = '`pawnee` = :pawnee';
- $bindArray[':pawnee'] = $pawnee;
- } else {
- $pawnee = "";
- }
- if(!empty($saline)){
- $whereClause[] = '`saline` = :saline';
- $bindArray[':saline'] = $saline;
- } else {
- $saline = "";
- }
- if(!empty($thayer)){
- $whereClause[] = '`thayer` = :thayer';
- $bindArray[':thayer'] = $thayer;
- } else {
- $thayer = "";
- }
- if(!empty($cass)){
- $whereClause[] = '`cass` = :cass';
- $bindArray[':cass'] = $cass;
- } else {
- $cass = "";
- }
- if(!empty($jefferson)){
- $whereClause[] = '`jefferson` = :jefferson';
- $bindArray[':jefferson'] = $jefferson;
- } else {
- $jefferson = "";
- }
- if(!empty($nemaha)){
- $whereClause[] = '`nemaha` = :nemaha';
- $bindArray[':nemaha'] = $nemaha;
- } else {
- $nemaha = "";
- }
- if(!empty($polk)){
- $whereClause[] = '`polk` = :polk';
- $bindArray[':polk'] = $polk;
- } else {
- $polk = "";
- }
- if(!empty($saunders)){
- $whereClause[] = '`saunders` = :saunders';
- $bindArray[':saunders'] = $saunders;
- } else {
- $saunders = "";
- }
- if(!empty($york)){
- $whereClause[] = '`york` = :york';
- $bindArray[':york'] = $york;
- } else {
- $york = "";
- }
- if(!empty($aro)){
- $whereClause[] = '`aro` = :aro';
- $bindArray[':aro'] = $aro;
- } else {
- $aro = "";
- }
- if(!empty($clergy)){
- $whereClause[] = '`clergy` = :clergy';
- $bindArray[':clergy'] = $clergy;
- } else {
- $clergy = "";
- }
- if(!empty($intskills)){
- $whereClause[] = '`intskills` = :intskills';
- $bindArray[':intskills'] = $intskills;
- } else {
- $intskills = "";
- }
- if(!empty($child)){
- $whereClause[] = '`child` = :child';
- $bindArray[':child'] = $child;
- } else {
- $child = "";
- }
- if(!empty($bus)){
- $whereClause[] = '`bus` = :bus';
- $bindArray[':bus'] = $bus;
- } else {
- $bus = "";
- }
- if(!empty($law)){
- $whereClause[] = '`law` = :law';
- $bindArray[':law'] = $law;
- } else {
- $law = "";
- }
- if(!empty($cpr)){
- $whereClause[] = '`cpr` = :cpr';
- $bindArray[':cpr'] = $cpr;
- } else {
- $cpr = "";
- }
- if(!empty($data)){
- $whereClause[] = '`data` = :data';
- $bindArray[':data'] = $data;
- } else {
- $data = "";
- }
- if(!empty($security)){
- $whereClause[] = '`security` = :security';
- $bindArray[':security'] = $security;
- } else {
- $security = "";
- }
- if(!empty($emergency)){
- $whereClause[] = '`emergency` = :emergency';
- $bindArray[':emergency'] = $emergency;
- } else {
- $emergency = "";
- }
- if(!empty($computer)){
- $whereClause[] = '`computer` = :computer';
- $bindArray[':computer'] = $computer;
- } else {
- $computer = "";
- }if(!empty($mechanical)){
- $whereClause[] = '`machanical` = :machanical';
- $bindArray[':machanical'] = $machanical;
- } else {
- $machanical = "";
- }
- if(!empty($administration)){
- $whereClause[] = '`administration` = :administration';
- $bindArray[':administration'] = $administration;
- } else {
- $administration = "";
- }
- if(!empty($firstaid)){
- $whereClause[] = '`firstaid` = :firstaid';
- $bindArray[':firstaid'] = $firstaid;
- } else {
- $firstaid = "";
- }
- if(!empty($translation)){
- $whereClause[] = '`translation` = :translation';
- $bindArray[':translation'] = $translation;
- } else {
- $translation = "";
- }
- if(!empty($construction)){
- $whereClause[] = '`construction` = :construction';
- $bindArray[':construction'] = $construction;
- } else {
- $construction = "";
- }
- if(!empty($basicclean)){
- $whereClause[] = '`basicclean` = :basicclean';
- $bindArray[':basicclean'] = $basicclean;
- } else {
- $basicclean = "";
- }
- if(!empty($foodprep)){
- $whereClause[] = '`foodprep` = :foodprep';
- $bindArray[':foodprep'] = $foodprep;
- } else {
- $foodprep = "";
- }
- if(!empty($animalcare)){
- $whereClause[] = '`animalcare` = :animalcare';
- $bindArray[':animalcare'] = $animalcare;
- } else {
- $animalcare = "";
- }
- if(!empty($heavy)){
- $whereClause[] = '`heavy` = :heavy';
- $bindArray[':heavy'] = $heavy;
- } else {
- $heavy = "";
- }
- if ($county1 == ""){
- $error = "Must select at least 1 Residential County.";
- echo $error;
- } elseif ($count2 == ""){
- $whereClause[] = '`county` = :county1';
- } elseif ($county3 == "") {
- $whereClause[] = '`county` = :county1 OR `county` = :county2';
- } elseif ($county4 == ""){
- $whereClause[] = '`county` = :county1 OR `county` = :county2 OR `county` = :county3';
- } elseif ($county5 == ""){
- $whereClause[] = '`county` = :county1 OR `county` = :county2 OR `county` = :county3 OR `county` = :county4';
- } elseif ($county6 == ""){
- $whereClause[] = '`county` = :county1 OR `county` = :county2 OR `county` = :county3 OR `county` = :county OR `county` = :county5';
- } else {
- $whereClause[] = '`county` = :county1 OR `county` = :county2 OR `county` = :county3 OR `county` = :county OR `county` = :county5 OR `county` = :county6';
- }
- if(!empty($license1)){
- $whereClause[] = '`license1` = :license1';
- $bindArray[':license1'] = $license1;
- }
- if(!empty($license2)){
- $whereClause[] = '`license2` = :license2';
- $bindArray[':license2'] = $license2;
- }
- if(!empty($license3)){
- $whereClause[] = '`license3` = :license3';
- $bindArray[':license3'] = $license3;
- }
- if(!empty($license4)){
- $whereClause[] = '`license4` = :license4';
- $bindArray[':license4'] = $license4;
- }
- if(!empty($license5)){
- $whereClause[] = '`license5` = :license5';
- $bindArray[':license5'] = $license5;
- }
- if(!empty($dis1)){
- $whereClause[] = '`dist1` = :dist1';
- $bindArray[':dist1'] = $dist1;
- }
- if(!empty($dist2)){
- $whereClause[] = '`dist2` = :dist2';
- $bindArray[':dist2'] = $dist2;
- }
- if(!empty($dist3)){
- $whereClause[] = '`dist3` = :dist3';
- $bindArray[':dist3'] = $dist3;
- }
- if(!empty($dist4)){
- $whereClause[] = '`dist4` = :dist4';
- $bindArray[':dist4'] = $dist4;
- }
- if(!empty($dist5)){
- $whereClause[] = '`dist5` = :dist5';
- $bindArray[':dist5'] = $dist5;
- }
- $dbh = new PDO('mysql:host=localhost;dbname=petrzilk_test;charset=utf8', 'petrzilk_dbAdmin', 'xxxxxxxxx');
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
- $stmtString = 'SELECT * FROM VolunDB';
- if(!empty($whereClause)) $stmtString .= ' WHERE ' . implode(' AND ', $whereClause);
- $stmt = $dbh->prepare($stmtString);
- $stmt->execute($bindArray);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement