Jump to content

PHP Help with multiple choice for search page (mySQL)


WebsiteDesigner

Recommended Posts

I have a multiple choice search page which asks visitors to select one or more choices before rendering the search results. It only works in items 1+2 are selected, or 1+2+3, or 1+2+3+4, or 1+2+3+4, etc...

 

I want to make it so that any combination of choices work. Example: Items 1+6 or 2+3+5 or 1+4+6 etc...

 

I have four hours to fix it before my client shows up and need help BADLY.

 

Anyone out there who can help? Whoever can help me... you are the best and I will have a special prayer for you tonight.

 

Here is the coding:

 

<?php } else{

if(!empty($_GET['latt']) && !empty($_GET['long']))

{

 

$condition="SELECT ( 3959 * acos( cos( radians(  '".$_GET['latt']."' ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(  '".$_GET['long']."' ) ) + sin( radians( '".$_GET['latt']."' ) ) * sin( radians( latitude ) ) ) ) as distance,id,membership FROM notary_members ";

 

if(!empty($_GET['s']))

{

$a=" where and";

}

else

{

$a=" where";

}

if($_GET['edoc']!='')

{

$condition.=$a." edoc= 'yes'";

}

if($_GET['esign']!='')

{

if($_GET['edoc']!='')

$condition.=" and esign= 'yes'";

else

$condition.=$a." esign= 'yes'";

}

if($_GET['laserprinter']!='')

{

if($_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and laserprinter= 'yes'";

else

$condition.=" laserprinter= 'yes'";

}

if($_GET['dualtray']!='')

{

if( $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and dualtray= 'yes'";

else

$condition.=" dualtray= 'yes'";

}

if($_GET['error_in']!='')

{

if($_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and error_in= 'yes'";

else

$condition.=" error_in= 'yes'";

}

if($_GET['bg_checked']!='')

{

if($_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and bg_checked= 'yes'";

else

$condition.=" bg_checked= 'yes'";

}

if($_GET['home_insp']!='')

{

if($_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and home_insp= 'yes'";

else

$condition.=" home_insp= 'yes'";

}

if($_GET['fingerprint']!='')

{

if($_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and fingerprint= 'yes'";

else

$condition.=" fingerprint= 'yes'";

}

if($_GET['hosp_signing']!='')

{

if($_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and hosp_signing= 'yes'";

else

$condition.=" hosp_signing= 'yes'";

}

if($_GET['jail_signing']!='')

{

if($_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and jail_signing= 'yes'";

else

$condition.=" jail_signing= 'yes'";

}

if($_GET['im_docs']!='')

{

if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and im_docs= 'yes'";

else

$condition.=" im_docs= 'yes'";

}

if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='' || $_GET['im_docs']!='')

{

$condition.=" and status=1 order by distance asc";

}

else

{

$condition.=$a." status=1 order by distance asc";

}

 

$sql=mysql_query($condition);

$num=mysql_num_rows($sql);

$getmile=explode(' ',$_GET['miles']);

 

        $c=0;

        while($getidres=mysql_fetch_array($sql))

{

          if($getidres['distance']<=$getmile[0])

  {

  if($getidres['membership']=='premium')

  {

  $prefirst[$getidres['id']]=$getidres['distance'];

  $c++;

  }

  else

  {

  $basicfirst[$getidres['id']]=$getidres['distance'];

    $c++;

  }

  }

        }

 

if(!empty($sql))

  {

 

    if($c!=0)

{

if(!empty($prefirst) || !empty($basicfirst))

{ ?>

Your logic doesn't have the right flow, try this:

<?php } else{
if(!empty($_GET['latt']) && !empty($_GET['long']))
{

$condition="SELECT ( 3959 * acos( cos( radians(  '".$_GET['latt']."' ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(  '".$_GET['long']."' ) ) + sin( radians( '".$_GET['latt']."' ) ) * sin( radians( latitude ) ) ) ) as distance,id,membership FROM notary_members ";
//declare an array, this will hold our columns if they are in the search params.
$queryCon = array();
//set the columns to an array ONLY if they exist in our search params.
   if(!empty($_GET['edoc'])) {
	$queryCon[] = 'edoc=\'yes\'';
}
   if(!empty($_GET['esign'])) {
        $queryCon[] ="esign= 'yes'";
   }
   if(!empty($_GET['laserprinter'])) {
        $queryCon[] ="laserprinter= 'yes'";
    }
   if(!empty($_GET['dualtray'])) {
      $queryCon[] ="dualtray= 'yes'";
    }
   if(!empty($_GET['error_in'])) {
      $queryCon[] ="error_in= 'yes'";
   }
   if(!empty($_GET['bg_checked'])) {
      $queryCon[] ="bg_checked= 'yes'";
   }
   if(!empty($_GET['home_insp'])) {
      $queryCon[] ="home_insp= 'yes'";
   }
   if(!empty($_GET['fingerprint'])) {
      $queryCon[] ="fingerprint= 'yes'";
   }
   if(!empty($_GET['hosp_signing'])) {
     $queryCon[] ="hosp_signing= 'yes'";
   }
   if(!empty($_GET['jail_signing'])) {
      $queryCon[] ="jail_signing= 'yes'";
   }
   if(!empty($_GET['im_docs'])) {
     $queryCon[] ="im_docs= 'yes'";
   }
//since you have a constant column called status, then make your WHERE.
$condition .= ' WHERE ';
//if the array isn't empty (search params exist ) then implode the columns.
   if(!empty($queryCon)) {
$condition .= implode(' AND ',$queryCon) . ' AND ';
}
//set the last part of the query, which would be the status column, and order by.	
$condition .= 'status = 1 ORDER BY distance ASC';

   $sql=mysql_query($condition);
   $num=mysql_num_rows($sql);
   $getmile=explode(' ',$_GET['miles']);
   
        $c=0;
        while($getidres=mysql_fetch_array($sql))
      {
          if($getidres['distance']<=$getmile[0])
        {
            if($getidres['membership']=='premium')
            {
            $prefirst[$getidres['id']]=$getidres['distance'];
            $c++;
            }
            else
            {
            $basicfirst[$getidres['id']]=$getidres['distance'];
             $c++;
            }
        }
        }
      
      if(!empty($sql))
     {
      
          if($c!=0)
         {
            if(!empty($prefirst) || !empty($basicfirst))
            { ?>

 

Functions used:

implode

empty

I am getting an error:

 

Parse error: syntax error, unexpected '}' in /home/content/76/8298276/html/advdetails.php on line 64

 

Whoever you are..... I am willing to pay you if you can fix the issue within two hours.

 

Let me know.

 

Thank you.

 

 

Since you posted a code snippet, and all of my brackets line up, I cannot tell where the error lies.  I do know that you cut the snippet inside of some brackets, make sure you have closing brackets for every opening one.

I am sorry I am new to this forum. Here is the full page:

 

<?php

include('includes/db.php');

include('includes/functions.php');

 

function distance($lat1, $lon1, $lat2, $lon2, $unit) {

 

$theta = $lon1 - $lon2;

$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));

$dist = acos($dist);

$dist = rad2deg($dist);

$miles = $dist * 60 * 1.1515;

$unit = strtoupper($unit);

 

if ($unit == "K") {

return ($miles * 1.609344);

} else if ($unit == "N") {

return ($miles * 0.8684);

} else {

return $miles;

}

}

 

 

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">

<head profile="http://gmpg.org/xfn/11">

<title></title>

<meta http-equiv="content-type" content="text/html;charset=UTF-8" />

<meta name="keywords" content="" />

<meta name="description" content="" />

<link rel="shortcut icon" href="images/favicon.ico" />

<link rel="stylesheet" type="text/css" href="css/stylesheet.css" media="screen" />

<link rel="stylesheet" type="text/css" href="css/coin-slider-styles.css" />

<link rel="stylesheet" type="text/css" href="css/menusm.css" />

<link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen" />

<link rel="stylesheet" href="css/pagenavi-css.css" type="text/css" media="screen" />

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>

<script type="text/javascript" src="js/menusm.js"></script>

<script type="text/javascript" src="js/coin-slider.min.js"></script>

<script type="text/javascript" src="js/hoverintent.js"></script>

<script type="text/javascript" src="js/superfish.js"></script>

<link rel="stylesheet" href="css/pagenavi-css.css" type="text/css" media="screen" />

<script type="text/javascript" src="js/fancybox/jquery.min.js"></script>

<script>

!window.jQuery && document.write('<script src="js/fancybox/jquery-1.4.3.min.js"><\/script>');

</script>

<script type="text/javascript" src="js/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>

<script type="text/javascript" src="js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>

<link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox-1.3.4.css" media="screen" />

<link rel="stylesheet" href="css/fancystyle.css" />

<script type="text/javascript"> $(document).ready(function() { $("a#example").fancybox(); }); </script>

</head>

<body>

<div id="page">

<?php include('header.php'); ?>

<div id="columns"><div class="header_left">

<?php include('menu.php'); ?></div><h2 style="padding-top:200px;padding-left:280px;">Please See Your Search Results Below</h2>

<div class="clr"></div>

<div id="centercol" style="width:700px;"><div class="box post" id="post-41">

<div class="content">

<div class="clr"></div>

<div class="post-excerpt">

<?php

if(isset($_GET['latt']) && isset($_GET['long']))

{

if($_GET['miles']=="Choose miles option...")

{

$condition="SELECT ( 3959 * acos( cos( radians(  '".$_GET['latt']."' ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(  '".$_GET['long']."' ) ) + sin( radians( '".$_GET['latt']."' ) ) * sin( radians( latitude ) ) ) ) as distance,id,membership FROM notary_members ";

 

if(!empty($_GET['s']))

{

$a=" where and";

}

else

{

$a=" where";

}

if($_GET['edoc']!='')

{

$condition.=$a." edoc= 'yes'";

}

if($_GET['esign']!='')

{

if($_GET['edoc']!='')

$condition.=" and esign= 'yes'";

else

$condition.=$a." esign= 'yes'";

}

if($_GET['laserprinter']!='')

{

if($_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and laserprinter= 'yes'";

else

$condition.=" laserprinter= 'yes'";

}

if($_GET['dualtray']!='')

{

if( $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and dualtray= 'yes'";

else

$condition.=" dualtray= 'yes'";

}

if($_GET['error_in']!='')

{

if($_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and error_in= 'yes'";

else

$condition.=" error_in= 'yes'";

}

if($_GET['bg_checked']!='')

{

if($_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and bg_checked= 'yes'";

else

$condition.=" bg_checked= 'yes'";

}

if($_GET['home_insp']!='')

{

if($_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and home_insp= 'yes'";

else

$condition.=" home_insp= 'yes'";

}

if($_GET['fingerprint']!='')

{

if($_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and fingerprint= 'yes'";

else

$condition.=" fingerprint= 'yes'";

}

if($_GET['hosp_signing']!='')

{

if($_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and hosp_signing= 'yes'";

else

$condition.=" hosp_signing= 'yes'";

}

if($_GET['jail_signing']!='')

{

if($_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and jail_signing= 'yes'";

else

$condition.=" jail_signing= 'yes'";

}

if($_GET['im_docs']!='')

{

if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and im_docs= 'yes'";

else

$condition.=" im_docs= 'yes'";

}

if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='' || $_GET['im_docs']!='')

{

$condition.=" and status=1 order by distance asc";

}

else

{

$condition.=$a." status=1 order by distance asc";

}

 

$sql=mysql_query($condition);

$num=mysql_num_rows($sql);

        $c=0;

        while($getidres=mysql_fetch_array($sql))

{

          if($getidres['distance']<=30)

  {

  if($getidres['membership']=='premium')

  {

  $prefirst[$getidres['id']]=$getidres['distance'];

  $c++;

  }

  else

  {

  $basicfirst[$getidres['id']]=$getidres['distance'];

    $c++;

  }

  }

        }

 

if(!empty($sql))

  {

 

    if($c!=0)

{

if(!empty($prefirst) || !empty($basicfirst))

{ ?>

 

<table border="0" cellpadding="0" cellspacing="0" style="background-color:#D4A017;height:20px;" width="1000px">

<tr>

<td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;"> Name</td>

<td width="200px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Company Name</td>

<td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">City, State and Zip Code</td>

<td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Profile</td>

<td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;font-variant:small-caps;">Estimated Miles</td>

</tr></table>

<?php }

 

if(!empty($prefirst))

{

?>

 

<table>

 

<table border="0" cellpadding="0" cellspacing="0" style="background-color:#1b76ff;color:#fff;height:20px;" width="1000px">

<tr>

<td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:10px 10px;">Premium Members</td>

</tr></table>

 

<tr><td> </td></tr>

 

</table>

<?php  foreach($prefirst as $key=>$value)

  {

  $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'");

    $data=mysql_fetch_object($sql); ?>

  <table border="0" cellpadding="0" cellspacing="0" width="1000px">

<tr onMouseOver="this.style.backgroundColor='#E1EAFE'"; onMouseOut="this.style.backgroundColor='transparent'">

<td width="300" style="text-align:left;  height:28px;">

 

<img src="images/75px-Blue_check_plus.svg.png" width="20" height="15" align="left" style="padding-right:10px;" />

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

 

<?php echo $data->firstname." ".$data->lastname; ?>

 

</a></td>

 

<td width="235" style="text-align:left;  height:28px;">

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

 

<?php if(!empty($data->bname)) { echo $data->bname; } ?>

</a></td>

 

<td width="243" style="text-align:left;  height:28px;">

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

 

<?php echo $data->city." ".$data->state." ".$data->zipcode;?></a></td>

 

 

 

<td width="112" style="text-align:left;font-weight:bold;  height:28px;">

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">» Profile

 

</a></td>

 

<td width="110" style="text-align:left;font-weight:bold;  height:28px;">

<?php echo round($value, 2)." Miles";?></td>

 

</tr></table>

<?php  }

 

}

if(!empty($basicfirst))

{ ?>

<table><tr><td> </td></tr></table>

 

<table border="0" cellpadding="0" cellspacing="0" style="background-color:#808080;color:#fff;height:20px;" width="1000px">

<tr>

<td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:2px 10px;">Basic Members</td>

</tr></table>

 

<tr><td> </td></tr>

 

</table>

<?php foreach($basicfirst as $key=>$value)

  { 

  $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'");

  $data=mysql_fetch_object($sql); ?>

  <table border="0" cellpadding="0" cellspacing="0" width="1000px">

<tr onMouseOver="this.style.backgroundColor='#E1EAFE'"; onMouseOut="this.style.backgroundColor='transparent'">

<td width="300"  style="text-align:left;height:28px;">

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal; margin-left:28px;">

 

<?php echo $data->firstname." ".$data->lastname; ?>

 

</a></td>

 

<td width="237"  style="text-align:left;height:28px; ">

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

 

<?php if(!empty($data->bname)) { echo $data->bname; } ?>

</a></td>

 

<td width="241" style="text-align:left;height:28px;">

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

 

<?php echo $data->city." ".$data->state." ".$data->zipcode;?></a></td>

 

 

 

<td width="112" style="text-align:left;font-weight:bold;height:28px;">

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">» Profile

 

</a></td>

<td width="110"  style="text-align:left;height:28px;">

<?php echo round($value, 2)." Miles";?></td>

 

</tr></table>

  <?php }

    }

}

else

{

?>

            <div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br>

              </br>

              If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php"  style="text-decoration:none;">Sign-up</a>. </div>

            <?php }

 

 

  } else

{

?>

<div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br>

              </br>

              If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php"  style="text-decoration:none;">Sign-up</a>. </div>

<?php } ?>

 

<?php } else{

if(!empty($_GET['latt']) && !empty($_GET['long']))

{

 

$condition="SELECT ( 3959 * acos( cos( radians(  '".$_GET['latt']."' ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(  '".$_GET['long']."' ) ) + sin( radians( '".$_GET['latt']."' ) ) * sin( radians( latitude ) ) ) ) as distance,id,membership FROM notary_members ";

 

if(!empty($_GET['s']))

{

$a=" where and";

}

else

{

$a=" where";

}

if($_GET['edoc']!='')

{

$condition.=$a." edoc= 'yes'";

}

if($_GET['esign']!='')

{

if($_GET['edoc']!='')

$condition.=" and esign= 'yes'";

else

$condition.=$a." esign= 'yes'";

}

if($_GET['laserprinter']!='')

{

if($_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and laserprinter= 'yes'";

else

$condition.=" laserprinter= 'yes'";

}

if($_GET['dualtray']!='')

{

if( $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and dualtray= 'yes'";

else

$condition.=" dualtray= 'yes'";

}

if($_GET['error_in']!='')

{

if($_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and error_in= 'yes'";

else

$condition.=" error_in= 'yes'";

}

if($_GET['bg_checked']!='')

{

if($_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and bg_checked= 'yes'";

else

$condition.=" bg_checked= 'yes'";

}

if($_GET['home_insp']!='')

{

if($_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and home_insp= 'yes'";

else

$condition.=" home_insp= 'yes'";

}

if($_GET['fingerprint']!='')

{

if($_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and fingerprint= 'yes'";

else

$condition.=" fingerprint= 'yes'";

}

if($_GET['hosp_signing']!='')

{

if($_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and hosp_signing= 'yes'";

else

$condition.=" hosp_signing= 'yes'";

}

if($_GET['jail_signing']!='')

{

if($_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and jail_signing= 'yes'";

else

$condition.=" jail_signing= 'yes'";

}

if($_GET['im_docs']!='')

{

if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')

$condition.=" and im_docs= 'yes'";

else

$condition.=" im_docs= 'yes'";

}

if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='' || $_GET['im_docs']!='')

{

$condition.=" and status=1 order by distance asc";

}

else

{

$condition.=$a." status=1 order by distance asc";

}

 

$sql=mysql_query($condition);

$num=mysql_num_rows($sql);

$getmile=explode(' ',$_GET['miles']);

 

        $c=0;

        while($getidres=mysql_fetch_array($sql))

{

          if($getidres['distance']<=$getmile[0])

  {

  if($getidres['membership']=='premium')

  {

  $prefirst[$getidres['id']]=$getidres['distance'];

  $c++;

  }

  else

  {

  $basicfirst[$getidres['id']]=$getidres['distance'];

    $c++;

  }

  }

        }

 

if(!empty($sql))

  {

 

    if($c!=0)

{

if(!empty($prefirst) || !empty($basicfirst))

{ ?>

 

<table border="0" cellpadding="0" cellspacing="0" style="background-color:#D4A017;height:20px;" width="1000px">

<tr>

<td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Notary Public Name</td>

<td width="200px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Company Name</td>

<td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">City, State and Zip Code</td>

<td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;font-variant:small-caps;">Profile</td>

<td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;font-variant:small-caps;">Estimated Miles</td>

</tr></table>

<?php }

 

if(!empty($prefirst))

{

?>

 

<table>

 

<table border="0" cellpadding="0" cellspacing="0" style="background-color:#1b76ff;color:#fff;height:20px;" width="1000px">

<tr>

<td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:10px 10px;">Premium Members</td>

</tr></table>

 

<tr><td> </td></tr>

 

</table>

<?php  foreach($prefirst as $key=>$value)

  {

  $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'");

    $data=mysql_fetch_object($sql); ?>

  <table border="0" cellpadding="0" cellspacing="0" width="1000px">

<tr>

<td width="300" style="text-align:left; height:28px;">

 

<img src="images/75px-Blue_check_plus.svg.png" width="20" height="15" align="left" style="padding-right:10px;" />

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

 

<?php echo $data->firstname." ".$data->lastname; ?>

 

</a></td>

 

<td width="231" style="text-align:left; height:28px;">

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

 

<?php if(!empty($data->bname)) { echo $data->bname; } ?>

</a></td>

 

<td width="247" style="text-align:left; height:28px;">

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

 

<?php echo $data->city." ".$data->state." ".$data->zipcode;?></a></td>

 

 

 

<td width="112" style="text-align:left;font-weight:bold; height:28px;">

 

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">

 

» Profile

 

</a></td>

 

<td width="110" style="text-align:left;font-weight:bold; height:28px;">

 

<?php echo round($value, 2)." Miles";?></td>

 

</tr></table>

<?php  }

 

}

if(!empty($basicfirst))

{ ?>

<table><tr><td> </td></tr></table>

 

<table border="0" cellpadding="0" cellspacing="0" style="background-color:#808080;color:#fff;height:20px;" width="1000px">

<tr>

<td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:2px 10px;">Basic Members</td>

</tr></table>

 

<tr><td> </td></tr>

 

</table>

<?php foreach($basicfirst as $key=>$value)

  { 

  $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'");

  $data=mysql_fetch_object($sql); ?>

  <table border="0" cellpadding="0" cellspacing="0" width="1000px">

<tr>

<td width="293"  style="text-align:left;border-right:solid 1px #fff;  height:28px;

">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal; margin-left:28px;">

<?php echo $data->firstname." ".$data->lastname; ?></a></td>

 

 

 

 

<td width="239"  style="text-align:left;border-right:solid 1px #fff;  height:28px;"><?php if(!empty($data->bname)) { echo $data->bname; } ?></td>

 

 

<td width="227"  style="text-align:left;border-right:solid 1px #fff;  height:28px;">

<?php echo $data->city." ".$data->state." ".$data->zipcode;?></td>

<td width="21"></td>

<td width="110" style="text-align:left;font-weight:bold;  height:28px;"><a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">» Profile  </a></td>

<td width="110"  style="text-align:left;  height:28px;">

<?php echo round($value, 2)." Miles";?></td>

 

</tr></table>

  <?php }

    }

}

else

{

?>

            <div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br>

              </br>

              If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php"  style="text-decoration:none;">Sign-up</a>. </div>

            <?php }

 

  }

}else

{?>

<div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br>

              </br>

              If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php"  style="text-decoration:none;">Sign-up</a>. </div>

<?php } } } ?>

</div>

</div></div>

 

<div class="clr"></div>

 

</div>

<div class="clr"></div></div>

 

<div class="clr"></div></div>

 

<?php include('footer.php'); ?><div class="clr"></div>

 

</div></body></html>

 

Please put all future code inside of

 

tags, it will help keep the thread cleaner.

 

This script has no parse errors, I have included what I wrote into the appropriate place.  You could also insert it into the top search as well.

<?php
include('includes/db.php');
include('includes/functions.php');

function distance($lat1, $lon1, $lat2, $lon2, $unit) {

$theta = $lon1 - $lon2;
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
$dist = acos($dist);
$dist = rad2deg($dist);
$miles = $dist * 60 * 1.1515;
$unit = strtoupper($unit);

if ($unit == "K") {
return ($miles * 1.609344);
} else if ($unit == "N") {
return ($miles * 0.8684);
} else {
return $miles;
}
}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head profile="http://gmpg.org/xfn/11">
<title></title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="shortcut icon" href="images/favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/stylesheet.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/coin-slider-styles.css" />
<link rel="stylesheet" type="text/css" href="css/menusm.css" />
<link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen" />
<link rel="stylesheet" href="css/pagenavi-css.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/menusm.js"></script>
<script type="text/javascript" src="js/coin-slider.min.js"></script>
<script type="text/javascript" src="js/hoverintent.js"></script>
<script type="text/javascript" src="js/superfish.js"></script>
<link rel="stylesheet" href="css/pagenavi-css.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/fancybox/jquery.min.js"></script>
<script>
   !window.jQuery && document.write('<script src="js/fancybox/jquery-1.4.3.min.js"><\/script>');
</script>
<script type="text/javascript" src="js/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="js/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="js/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
<link rel="stylesheet" href="css/fancystyle.css" />
<script type="text/javascript"> $(document).ready(function() { $("a#example").fancybox(); }); </script>
</head>
<body>
<div id="page">
<?php include('header.php'); ?>
<div id="columns"><div class="header_left">
<?php include('menu.php'); ?></div><h2 style="padding-top:200px;padding-left:280px;">Please See Your Search Results Below</h2>
<div class="clr"></div>
<div id="centercol" style="width:700px;"><div class="box post" id="post-41">
<div class="content">
<div class="clr"></div>
<div class="post-excerpt">
<?php
if(isset($_GET['latt']) && isset($_GET['long']))
{
if($_GET['miles']=="Choose miles option...")
{
$condition="SELECT ( 3959 * acos( cos( radians(  '".$_GET['latt']."' ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(  '".$_GET['long']."' ) ) + sin( radians( '".$_GET['latt']."' ) ) * sin( radians( latitude ) ) ) ) as distance,id,membership FROM notary_members ";

   if(!empty($_GET['s']))
   {
      $a=" where and";
   }
   else
   {
      $a=" where";
   }
   if($_GET['edoc']!='')
   {
      $condition.=$a." edoc= 'yes'";
   }
   if($_GET['esign']!='')
   {
      if($_GET['edoc']!='')
         $condition.=" and esign= 'yes'";
      else
         $condition.=$a." esign= 'yes'";
   }
   if($_GET['laserprinter']!='')
   {
      if($_GET['esign']!='' || $_GET['edoc']!='')
         $condition.=" and laserprinter= 'yes'";
      else
         $condition.=" laserprinter= 'yes'";
   }
   if($_GET['dualtray']!='')
   {
      if( $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')
         $condition.=" and dualtray= 'yes'";
      else
         $condition.=" dualtray= 'yes'";
   }
   if($_GET['error_in']!='')
   {
      if($_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')
         $condition.=" and error_in= 'yes'";
      else
         $condition.=" error_in= 'yes'";
   }
   if($_GET['bg_checked']!='')
   {
      if($_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')
         $condition.=" and bg_checked= 'yes'";
      else
         $condition.=" bg_checked= 'yes'";
   }
   if($_GET['home_insp']!='')
   {
      if($_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')
         $condition.=" and home_insp= 'yes'";
      else
         $condition.=" home_insp= 'yes'";
   }
   if($_GET['fingerprint']!='')
   {
      if($_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')
         $condition.=" and fingerprint= 'yes'";
      else
         $condition.=" fingerprint= 'yes'";
   }
   if($_GET['hosp_signing']!='')
   {
      if($_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')
         $condition.=" and hosp_signing= 'yes'";
      else
         $condition.=" hosp_signing= 'yes'";
   }
   if($_GET['jail_signing']!='')
   {
      if($_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')
         $condition.=" and jail_signing= 'yes'";
      else
         $condition.=" jail_signing= 'yes'";
   }
   if($_GET['im_docs']!='')
   {
      if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='')
         $condition.=" and im_docs= 'yes'";
      else
         $condition.=" im_docs= 'yes'";
   }
   if($_GET['jail_signing']!='' || $_GET['hosp_signing']!='' || $_GET['fingerprint']!='' || $_GET['home_insp']!='' || $_GET['bg_checked']!='' || $_GET['error_in']!='' || $_GET['dualtray']!='' || $_GET['laserprinter']!='' || $_GET['esign']!='' || $_GET['edoc']!='' || $_GET['im_docs']!='')
   {
    $condition.=" and status=1 order by distance asc";
    }
    else
    {
    $condition.=$a." status=1 order by distance asc";
    }

   $sql=mysql_query($condition);
   $num=mysql_num_rows($sql);
        $c=0;
        while($getidres=mysql_fetch_array($sql))
      {
          if($getidres['distance']<=30)
        {
            if($getidres['membership']=='premium')
            {
            $prefirst[$getidres['id']]=$getidres['distance'];
            $c++;
            }
            else
            {
            $basicfirst[$getidres['id']]=$getidres['distance'];
             $c++;
            }
        }
        }

if(!empty($sql))
     {
      
          if($c!=0)
         {
            if(!empty($prefirst) || !empty($basicfirst))
            { ?>
            
            <table border="0" cellpadding="0" cellspacing="0" style="background-color:#D4A017;height:20px;" width="1000px">
<tr>
<td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;"> Name</td>
<td width="200px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Company Name</td>
<td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">City, State and Zip Code</td>
<td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Profile</td>
<td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;font-variant:small-caps;">Estimated Miles</td>
</tr></table>
            <?php }
            
            if(!empty($prefirst))
            {
            ?>
            
<table>

<table border="0" cellpadding="0" cellspacing="0" style="background-color:#1b76ff;color:#fff;height:20px;" width="1000px">
<tr>
<td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:10px 10px;">Premium Members</td>
</tr></table>

<tr><td> </td></tr>

</table>
               <?php  foreach($prefirst as $key=>$value)
     {
     $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'");
       $data=mysql_fetch_object($sql); ?>
     <table border="0" cellpadding="0" cellspacing="0" width="1000px">
<tr onMouseOver="this.style.backgroundColor='#E1EAFE'"; onMouseOut="this.style.backgroundColor='transparent'">
<td width="300" style="text-align:left;  height:28px;">

<img src="images/75px-Blue_check_plus.svg.png" width="20" height="15" align="left" style="padding-right:10px;" />

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

<?php echo $data->firstname." ".$data->lastname; ?>

</a></td>

<td width="235" style="text-align:left;  height:28px;">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

<?php if(!empty($data->bname)) { echo $data->bname; } ?>
</a></td>

<td width="243" style="text-align:left;  height:28px;">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

<?php echo $data->city." ".$data->state." ".$data->zipcode;?></a></td>



<td width="112" style="text-align:left;font-weight:bold;  height:28px;">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">» Profile

</a></td>

<td width="110" style="text-align:left;font-weight:bold;  height:28px;">
<?php echo round($value, 2)." Miles";?></td>

</tr></table>
   <?php   }
               
             }
            if(!empty($basicfirst))
            { ?>
            <table><tr><td> </td></tr></table>

<table border="0" cellpadding="0" cellspacing="0" style="background-color:#808080;color:#fff;height:20px;" width="1000px">
<tr>
<td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:2px 10px;">Basic Members</td>
</tr></table>

<tr><td> </td></tr>

</table>
<?php foreach($basicfirst as $key=>$value)
     { 
      $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'");
     $data=mysql_fetch_object($sql); ?>
     <table border="0" cellpadding="0" cellspacing="0" width="1000px">
<tr onMouseOver="this.style.backgroundColor='#E1EAFE'"; onMouseOut="this.style.backgroundColor='transparent'">
<td width="300"  style="text-align:left;height:28px;">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal; margin-left:28px;">

<?php echo $data->firstname." ".$data->lastname; ?>

</a></td>

<td width="237"  style="text-align:left;height:28px; ">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

<?php if(!empty($data->bname)) { echo $data->bname; } ?>
</a></td>

<td width="241" style="text-align:left;height:28px;">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

<?php echo $data->city." ".$data->state." ".$data->zipcode;?></a></td>



<td width="112" style="text-align:left;font-weight:bold;height:28px;">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">» Profile

</a></td>
<td width="110"  style="text-align:left;height:28px;">
<?php echo round($value, 2)." Miles";?></td>

</tr></table>
     <?php }
             }
         }
         else
   {
?>
            <div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br>
              </br>
              If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php"  style="text-decoration:none;">Sign-up</a>. </div>
            <?php }
         
    
     } else
   {
?>
<div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br>
              </br>
              If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php"  style="text-decoration:none;">Sign-up</a>. </div>
<?php } ?>

<?php } else{
if(!empty($_GET['latt']) && !empty($_GET['long']))
{

$condition="SELECT ( 3959 * acos( cos( radians(  '".$_GET['latt']."' ) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(  '".$_GET['long']."' ) ) + sin( radians( '".$_GET['latt']."' ) ) * sin( radians( latitude ) ) ) ) as distance,id,membership FROM notary_members ";
//declare an array, this will hold our columns if they are in the search params.
$queryCon = array();
//set the columns to an array ONLY if they exist in our search params.
   if(!empty($_GET['edoc'])) {
	$queryCon[] = 'edoc=\'yes\'';
}
   if(!empty($_GET['esign'])) {
        $queryCon[] ="esign= 'yes'";
   }
   if(!empty($_GET['laserprinter'])) {
        $queryCon[] ="laserprinter= 'yes'";
    }
   if(!empty($_GET['dualtray'])) {
      $queryCon[] ="dualtray= 'yes'";
    }
   if(!empty($_GET['error_in'])) {
      $queryCon[] ="error_in= 'yes'";
   }
   if(!empty($_GET['bg_checked'])) {
      $queryCon[] ="bg_checked= 'yes'";
   }
   if(!empty($_GET['home_insp'])) {
      $queryCon[] ="home_insp= 'yes'";
   }
   if(!empty($_GET['fingerprint'])) {
      $queryCon[] ="fingerprint= 'yes'";
   }
   if(!empty($_GET['hosp_signing'])) {
     $queryCon[] ="hosp_signing= 'yes'";
   }
   if(!empty($_GET['jail_signing'])) {
      $queryCon[] ="jail_signing= 'yes'";
   }
   if(!empty($_GET['im_docs'])) {
     $queryCon[] ="im_docs= 'yes'";
   }
//since you have a constant column called status, then make your WHERE.
$condition .= ' WHERE ';
//if the array isn't empty (search params exist ) then implode the columns.
   if(!empty($queryCon)) {
$condition .= implode(' AND ',$queryCon) . ' AND ';
}
//set the last part of the query, which would be the status column, and order by.	
$condition .= 'status = 1 ORDER BY distance ASC';

   $sql=mysql_query($condition);
   $num=mysql_num_rows($sql);
   $getmile=explode(' ',$_GET['miles']);
   
        $c=0;
        while($getidres=mysql_fetch_array($sql))
      {
          if($getidres['distance']<=$getmile[0])
        {
            if($getidres['membership']=='premium')
            {
            $prefirst[$getidres['id']]=$getidres['distance'];
            $c++;
            }
            else
            {
            $basicfirst[$getidres['id']]=$getidres['distance'];
             $c++;
            }
        }
        }
      
      if(!empty($sql))
     {
      
          if($c!=0)
         {
            if(!empty($prefirst) || !empty($basicfirst))
            { ?>

            
            <table border="0" cellpadding="0" cellspacing="0" style="background-color:#D4A017;height:20px;" width="1000px">
<tr>
<td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Notary Public Name</td>
<td width="200px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">Company Name</td>
<td width="300px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;border-right:solid 1px #fff;font-variant:small-caps;">City, State and Zip Code</td>
<td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;font-variant:small-caps;">Profile</td>
<td width="100px" style="margin-left:10px;text-align:center;font-weight:bold;padding:10px;font-variant:small-caps;">Estimated Miles</td>
</tr></table>
            <?php }
            
            if(!empty($prefirst))
            {
            ?>
            
<table>

<table border="0" cellpadding="0" cellspacing="0" style="background-color:#1b76ff;color:#fff;height:20px;" width="1000px">
<tr>
<td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:10px 10px;">Premium Members</td>
</tr></table>

<tr><td> </td></tr>

</table>
               <?php  foreach($prefirst as $key=>$value)
     {
     $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'");
       $data=mysql_fetch_object($sql); ?>
     <table border="0" cellpadding="0" cellspacing="0" width="1000px">
<tr>
<td width="300" style="text-align:left; height:28px;">

<img src="images/75px-Blue_check_plus.svg.png" width="20" height="15" align="left" style="padding-right:10px;" />

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

<?php echo $data->firstname." ".$data->lastname; ?>

</a></td>

<td width="231" style="text-align:left; height:28px;">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

<?php if(!empty($data->bname)) { echo $data->bname; } ?>
</a></td>

<td width="247" style="text-align:left; height:28px;">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal;">

<?php echo $data->city." ".$data->state." ".$data->zipcode;?></a></td>



<td width="112" style="text-align:left;font-weight:bold; height:28px;">

<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">

» Profile

</a></td>

<td width="110" style="text-align:left;font-weight:bold; height:28px;">

<?php echo round($value, 2)." Miles";?></td>

</tr></table>
   <?php   }
               
             }
            if(!empty($basicfirst))
            { ?>
            <table><tr><td> </td></tr></table>

<table border="0" cellpadding="0" cellspacing="0" style="background-color:#808080;color:#fff;height:20px;" width="1000px">
<tr>
<td colspan="3" style="margin-left:10px;text-align:left;font-weight:bold;padding:2px 10px;">Basic Members</td>
</tr></table>

<tr><td> </td></tr>

</table>
<?php foreach($basicfirst as $key=>$value)
     { 
      $sql=mysql_query("SELECT * FROM notary_members WHERE id='".$key."'");
     $data=mysql_fetch_object($sql); ?>
     <table border="0" cellpadding="0" cellspacing="0" width="1000px">
<tr>
<td width="293"  style="text-align:left;border-right:solid 1px #fff;  height:28px;
">
<a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;color:#353635;font-weight:normal; margin-left:28px;">
<?php echo $data->firstname." ".$data->lastname; ?></a></td>




<td width="239"  style="text-align:left;border-right:solid 1px #fff;  height:28px;"><?php if(!empty($data->bname)) { echo $data->bname; } ?></td>


<td width="227"  style="text-align:left;border-right:solid 1px #fff;  height:28px;">
<?php echo $data->city." ".$data->state." ".$data->zipcode;?></td>
<td width="21"></td>
<td width="110" style="text-align:left;font-weight:bold;  height:28px;"><a href="notarydetails.php?id=<?php echo $data->id;?>" style="text-decoration:none;">» Profile  </a></td>
<td width="110"  style="text-align:left;  height:28px;">
<?php echo round($value, 2)." Miles";?></td>

</tr></table>
     <?php }
             }
         }
         else
   {
?>
            <div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br>
              </br>
              If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php"  style="text-decoration:none;">Sign-up</a>. </div>
            <?php }
         
     }
}else
         {?>
         <div align="center" style="color:#353635;">We are sorry. There are no registered Notary Publics in the area you have selected. You can choose to start a new search <a href="advancedsearch.php" style="text-decoration:none;">(Advanced Search)</a> or <a href="email.php" style="text-decoration:none;">email us here</a>.</br>
              </br>
              If you are a Notary Public and wish to advertise your services, simply click on the following link: <a href="membership.php"  style="text-decoration:none;">Sign-up</a>. </div>
      <?php } } } ?>
</div>
</div></div>

<div class="clr"></div>

</div>
<div class="clr"></div></div>

<div class="clr"></div></div>

<?php include('footer.php'); ?><div class="clr"></div>

</div></body></html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.