Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $whereClause = "WHERE ";
- $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);
- echo $general;
- if ($bhv == ""){
- $bhv = "";
- } else
- {
- $whereClause = $whereClause . "bhv = " . $bhv . " AND ";
- }
- if ($mrc == ""){
- $mrc = "";
- }else
- {
- $whereClause = $whereClause . "mrc = " . $mrc . " AND ";
- }
- if ($general == ""){
- $general = "";
- }else
- {
- $whereClause = $whereClause . "general = " . $general . " AND ";
- }
- if ($evv == ""){
- $evv = "";
- }else
- {
- $whereClause = $whereClause . "evv = " . $evv . " AND ";
- }
- if ($allCounties == ""){
- $allCounties = "";
- }else
- {
- $whereClause = $whereClause . "allCounties = " . $allCounties . " AND ";
- }
- if ($fillmore == ""){
- $fillmore = "";
- }else
- {
- $whereClause = $whereClause . "fillmore = " . $fillmore . " AND ";
- }
- if ($johnson == ""){
- $johnson = "";
- }else
- {
- $whereClause = $whereClause . "johnson = " . $johnson . " AND ";
- }
- if ($otoe == ""){
- $otoe = "";
- }else
- {
- $whereClause = $whereClause . "otoe = " . $otoe . " AND ";
- }
- if ($richardson == ""){
- $richardson = "";
- }else
- {
- $whereClause = $whereClause . "richardson = " . $richardson . " AND ";
- }
- if ($seward == ""){
- $seward = "";
- }else
- {
- $whereClause = $whereClause . "seward = " . $seward . " AND ";
- }
- if ($butler == ""){
- $butler = "";
- }else
- {
- $whereClause = $whereClause . "butler = " . $butler . " AND ";
- }
- if ($gage == ""){
- $gage = "";
- }else
- {
- $whereClause = $whereClause . "gage = " . $gage . " AND ";
- }
- if ($lancaster == ""){
- $lancaster = "";
- }else
- {
- $whereClause = $whereClause . "lancaster = " . $lancaster . " AND ";
- }
- if ($pawnee == ""){
- $pawnee = "";
- }else
- {
- $whereClause = $whereClause . "pawnee = " . $pawnee . " AND ";
- }
- if ($saline == ""){
- $saline = "";
- }else
- {
- $whereClause = $whereClause . "saline = " . $saline . " AND ";
- }
- if ($thayer == ""){
- $thayer = "";
- }else
- {
- $whereClause = $whereClause . "thayer = " . $thayer . " AND ";
- }
- if ($cass == ""){
- $cass = "";
- }else
- {
- $whereClause = $whereClause . "cass = " . $cass . " AND ";
- }
- if ($jefferson == ""){
- $jefferson = "";
- }else
- {
- $whereClause = $whereClause . "jefferson = " . $jefferson . " AND ";
- }
- if ($nemaha == ""){
- $nemaha = "";
- }else
- {
- $whereClause = $whereClause . "nemaha = " . $nemaha . " AND ";
- }
- if ($polk == ""){
- $polk = "";
- }else
- {
- $whereClause = $whereClause . "polk = " . $polk . " AND ";
- }
- if ($saunders == ""){
- $saunders = "";
- }else
- {
- $whereClause = $whereClause . "saunders = " . $saunders . " AND ";
- }
- if ($york == ""){
- $york = "";
- }else
- {
- $whereClause = $whereClause . "york = " . $york . " AND ";
- }
- if ($aro == ""){
- $aro = "";
- }else
- {
- $whereClause = $whereClause . "aro = " . $aro . " AND ";
- }
- if ($clergy == ""){
- $clergy = "";
- }else
- {
- $whereClause = $whereClause . "clergy = " . $clergy . " AND ";
- }
- if ($intskills == ""){
- $intskills = "";
- }else
- {
- $whereClause = $whereClause . "intskills = " . $intskills . " AND ";
- }
- if ($child == ""){
- $child = "";
- }else
- {
- $whereClause = $whereClause . "child = " . $child . " AND ";
- }
- if ($bus == ""){
- $bus = "";
- }else
- {
- $whereClause = $whereClause . "bus = " . $bus . " AND ";
- }
- if ($law == ""){
- $law = "";
- }else
- {
- $whereClause = $whereClause . "law = " . $law . " AND ";
- }
- if ($cpr == ""){
- $cpr = "";
- }else
- {
- $whereClause = $whereClause . "cpr = " . $cpr . " AND ";
- }
- if ($data == ""){
- $data = "";
- }else
- {
- $whereClause = $whereClause . "data = " . $data . " AND ";
- }
- if ($security == ""){
- $security = "";
- }else
- {
- $whereClause = $whereClause . "security = " . $security . " AND ";
- }
- if ($emergency == ""){
- $emergency = "";
- }else
- {
- $whereClause = $whereClause . "emergency = " . $emergency . " AND ";
- }
- if ($computer == ""){
- $computer = "";
- }else
- {
- $whereClause = $whereClause . "computer = " . $computer . " AND ";
- }
- if ($mechanical == ""){
- $mechanical = "";
- }else
- {
- $whereClause = $whereClause . "mechanical = " . $mechanical . " AND ";
- }
- if ($administration == ""){
- $administration = "";
- }else
- {
- $whereClause = $whereClause . "administration = " . $administration . " AND ";
- }
- if ($firstaid == ""){
- $firstaid = "";
- }else
- {
- $whereClause = $whereClause . "firstaid = " . $firstaid . " AND ";
- }
- if ($faid == ""){
- $faid = "";
- }else
- {
- $whereClause = $whereClause . "faid = " . $faid . " AND ";
- }
- if ($translation == ""){
- $translation = "";
- }else
- {
- $whereClause = $whereClause . "translation = " . $translation . " AND ";
- }
- if ($construction == ""){
- $construction = "";
- }else
- {
- $whereClause = $whereClause . "construction = " . $construction . " AND ";
- }
- if ($basicclean == ""){
- $basicclean = "";
- }else
- {
- $whereClause = $whereClause . "basicclean = " . $basicclean . " AND ";
- }
- if ($foodprep == ""){
- $foodprep = "";
- }else
- {
- $whereClause = $whereClause . "foodprep = " . $foodprep . " AND ";
- }
- if ($animalcare == ""){
- $animalcare = "";
- }else
- {
- $whereClause = $whereClause . "aniamalcare = " . $animalcare . " AND ";
- }
- if ($heavy == ""){
- $heavy = "";
- }else
- {
- $whereClause = $whereClause . "heavy = " . $heavy . " AND ";
- }
- if ($county1 == ""){
- $error = "Must select at least 1 Residential County.";
- } elseif ($count2 == ""){
- $whereClause = $whereClause . "county = " . $county1 . " AND ";
- } elseif ($county3 == "") {
- $whereClause = $whereClause . "county = " . $county1 . " OR county = " . $county2 . " AND ";
- } elseif ($county4 == ""){
- $whereClause = $whereClause . "county = " . $county1 . " OR county = " . $county2 . " OR county = " . $county3 . " AND ";
- } elseif ($county5 == ""){
- $whereClause = $whereClause . "county = " . $county1 . " OR county = " . $county2 . " OR county = " . $county3 . "OR county = " . $count4 . " AND ";
- } elseif ($county6 == ""){
- $whereClause = $whereClause . "county = " . $county1 . " OR county = " . $county2 . " OR county = " . $county3 . "OR county = " . $count4 . " OR county = " . $county5 . " AND ";
- } else {
- $whereClause = $whereClause . "county = " . $county1 . " OR county = " . $county2 . " OR county = " . $county3 . "OR county = " . $count4 . " OR county = " . $county5 . " OR county = " . $county6 . " AND ";
- }
- if ($license1 != "" ){
- $whereClause = $whereClause . "license1 = " . $license1 . " AND ";
- }
- if ($license2 != "" ){
- $whereClause = $whereClause . "license2 = " . $license2 . " AND ";
- }
- if ($license3 != "" ){
- $whereClause = $whereClause . "license3 = " . $license3 . " AND ";
- }
- if ($license4 != "" ){
- $whereClause = $whereClause . "license4 = " . $license4 . " AND ";
- }
- if ($license5 != "" ){
- $whereClause = $whereClause . "license5 = " . $license5 . " AND ";
- }
- if ($dist1 != "" ){
- $whereClause = $whereClause . "dist1 = " . $dist1 . " AND ";
- }if ($dist2 != "" ){
- $whereClause = $whereClause . "dist2 = " . $dist2 . " AND ";
- }if ($dist3 != "" ){
- $whereClause = $whereClause . "dist3 = " . $dist3 . " AND ";
- }
- if ($dist4 != "" ){
- $whereClause = $whereClause . "dist4 = " . $dist4 . " AND ";
- }
- if ($dist5 != "" ){
- $whereClause = $whereClause . "dist5 = " . $dist5 . " AND ";
- }
- $db = new PDO('mysql:host=localhost;dbname=petrzilk_test;charset=utf8', 'petrzilk_dbAdmin', 'XXXXXXXXXX'); // Connecting to Database
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Error statement
- $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
- $query = $db->prepare("SELECT * FROM VolunDB " . $whereClause . " 1 = 1");
- $query->execute();
- $result = $query->fetch(PDO::FETCH_OBJ);
- $table = $result->fname . " " . $result->lname;
- echo $table ;
- echo $whereClause;
- echo $general;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement