Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (empty($_GET['avgrating']) && empty($_GET['location'])) //both field is empty will only filter by contract type
- {
- $sql="SELECT email,contract_type,phonenumber,postalcode FROM contractors WHERE contract_type='" . $_GET['contract_type'] . "'";
- echo "no opt ";
- }
- elseif (empty($_GET['location'])) // location field is empty and will ony filter by contract and rating
- {
- $sql="SELECT email,contract_type,phonenumber,postalcode FROM contractors WHERE contract_type='" . $_GET['contract_type'] . "' AND avgrating >='" . $_GET['avgrating'] . "'";
- echo "avg ";
- }
- elseif (empty($_GET['avgrating'])) //avgrating field is empty
- {
- $sql="SELECT email,contract_type,phonenumber,postalcode FROM contractors WHERE contract_type='" . $_GET['contract_type'] . "' AND location='" . $_GET['location'] . "'";
- echo "location ";
- }
- else //all field is provided
- {
- $sql="SELECT email,contract_type,phonenumber,postalcode FROM contractors WHERE contract_type='" . $_GET['contract_type'] . "' AND avgrating >='" . $_GET['avgrating'] . "' AND location='" . $_GET['location'] . "'";
- echo "avg + location ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement