Jump to content

search problem


rex9990

Recommended Posts

hi guys,

Hope that some one can help in this,

My site is for rental listings and as one of the options for when a person listing is to have there ad bold title and a differnt background, however normal listings dont have this feature. My problem is that i cant figure out the way of making this happen, as its only showing up the normal listings even when the Priority Level is different.

here is the code,

if($a1[PriorityLevel] <= "1")
    {
$ListingTable .= "<br>";

if($lrows > '0')
{

   $ListingTable .= "<table align=center width=90% border=1 rules=rows cellspacing=0 style=\"border-collapse:collapse;\">\n";

   while($a1 = mysql_fetch_array($r1))
   {
   
      	$ListingTable .= "<tr style=\"border-width:1;border-color:blue\" onMouseOver=\"this.style.background='#eeeeee'; this.style.cursor='hand'\" onMouseOut=\"this.style.background='#ffffff'\" onClick=\"window.open('info.php?id=$a1[ListingID]', '_top')\">\n\t";
      $ListingTable .= "<td height=60>";

      $ListingTable .= "<table align=center width=\"100%\">\n";
      

if($aset[sitefee]=="0")
      {
      $ListingTable .= "<caption align=center><span class=RedLink>$a1[rooms] bed-roomed $a1[PropertyType] in $a1[city], $a1[country]. Sleeps $a1[sleeps].</span></caption>\n";
      }

      $ListingTable .= "<tr>\n\t<td width=75>";

      if(!empty($a1[image]))
      {
         $images = explode("|", $a1[image]);
         $MyImage = $images[0];

         $ListingTable .= "<img src=\"re_images/$MyImage\" width=75 height=60 border=1>";
      }
      else
      {
         $ListingTable .= "<img src=\"no_image.gif\" border=1>";
      }

      $ListingTable .= "</td>\n\t";

      $ListingTable .= "<td width=225 valign=top><b>Property ID: $a1[ListingID]</b><br>$a1[address], $a1[city]<br>$a1[state], $a1[country]</td>\n\t";
      $ListingTable .= "<td width=100 valign=top>$a1[rooms] Bedroom(s),<br> $a1[bathrooms] bathroom(s)";

      $min1 = $a1[MinPriceW];
  $min2 = $a1[MinPriceSp];
  $min3 = $a1[MinPriceA];
  $min4 = $a1[MinPriceSu];
  $divide = 4;
  $max1 = $a1[MaxPriceW];
  $max2 = $a1[MaxPriceSp];
  $max3 = $a1[MaxPriceA];
  $max4 = $a1[MaxPriceSu];
  $r_minprice = ($min1 + $min2 + $min3 + $min4) / $divide;
  $r_maxprice = ($max1 + $max2 + $max3 + $max4) / $divide;
      $MyPrice = number_format($r_minprice, 2, ".", ",");
  $MyPrice2 = number_format($r_maxprice, 2, ".", ",");

  $ListingTable .= "<br><strong>Price Range:</strong> $aset[Currencya]$MyPrice - $aset[Currencya]$MyPrice2 pw<br />\n";
  
      $ListingTable .= "</tr>\n";

      $ListingTable .= "<tr>\n\t<td colspan=4>$a1[shortDesc]</td>\n</tr>\n";

      $ListingTable .= "</table>\n\n</td>\n</tr>\n\n";

   }


   $ListingTable .= "</table>";

      $rnav = mysql_query($qnav) or die(mysql_error());
      $rows = mysql_num_rows($rnav);

         if($rows > $ByPage)
         {
            $ListingTable .=  "<br><table align=center width=100%>";
            $ListingTable .= "<td align=center><font face=verdana size=2> ";

            $pages = ceil($rows/$ByPage);

            for($i = 0; $i <= ($pages); $i++)
            {
               $PageStart = $ByPage*$i;
   
               $i2 = $i + 1;
   
               if($PageStart == $Start)
               {
                  $links[] = " <span class=RedLink>$i2</span>\n\t ";
               }
               elseif($PageStart < $rows)
               {
                  $links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&search_country=$_GET[search_country]&search_PropertyType=$_GET[search_PropertyType]&MinPrice=$_GET[MinPrice]&MaxPrice=$_GET[MaxPrice]&rooms1=$_GET[rooms1]&rooms2=$_GET[rooms2]&bath1=$_GET[bath1]&bath2=$_GET[bath2]&before=$_GET[before]&school=$_GET[school]&transit=$_GET[transit]&park=$_GET[park]&ocean_view=$_GET[ocean_view]&lake_view=$_GET[lake_view]&mountain_view=$_GET[mountain_view]&ocean_waterfront=$_GET[ocean_waterfront]&lake_waterfront=$_GET[lake_waterfront]&river_waterfront=$_GET[river_waterfront]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t ";  
               }
            }

            //$links2 = implode(" | ", $links);
      
            //$ListingTable .= $links2;

            $ListingTable .= " </td>";

            $ListingTable .= "</table><br>\n";

         }
}
if
($a1[PriorityLevel] >= "2")
   {
$ListingTable = "<br>";

	if($lrows > '0')
{

   $ListingTable .= "<table align=center width=90% border=1 background=images/search_bg.gif rules=rows cellspacing=0 style=\"border-collapse:collapse;\">\n";

   while($a1 = mysql_fetch_array($r1))
   {

      	$ListingTable .= "<tr style=\"border-width:1;border-color:blue\" onMouseOver=\"this.style.background='#ffffff'; this.style.cursor='hand'\" onMouseOut=\"this.style.background='#76cbeb'\" onClick=\"window.open('info.php?id=$a1[ListingID]', '_top')\">\n\t";
      $ListingTable .= "<td height=60>";

      $ListingTable .= "<table align=center width=\"100%\">\n";


if($aset[sitefee]=="0")
      {
      $ListingTable .= "<caption align=center><span class=RedLink><strong>$a1[rooms] bed-roomed $a1[PropertyType] in $a1[city], $a1[country]. Sleeps $a1[sleeps].</strong></span></caption>\n";
      }

      $ListingTable .= "<tr>\n\t<td width=75>";

      if(!empty($a1[image]))
      {
         $images = explode("|", $a1[image]);
         $MyImage = $images[0];

         $ListingTable .= "<img src=\"re_images/$MyImage\" width=75 height=60 border=1>";
      }
      else
      {
         $ListingTable .= "<img src=\"no_image.gif\" border=1>";
      }

      $ListingTable .= "</td>\n\t";

      $ListingTable .= "<td width=225 valign=top><b>Property ID: $a1[ListingID]</b><br>$a1[address], $a1[city]<br>$a1[state], $a1[country]</td>\n\t";
      $ListingTable .= "<td width=100 valign=top>$a1[rooms] Bedroom(s),<br> $a1[bathrooms] bathroom(s)";

      $min1 = $a1[MinPriceW];
  $min2 = $a1[MinPriceSp];
  $min3 = $a1[MinPriceA];
  $min4 = $a1[MinPriceSu];
  $divide = 4;
  $max1 = $a1[MaxPriceW];
  $max2 = $a1[MaxPriceSp];
  $max3 = $a1[MaxPriceA];
  $max4 = $a1[MaxPriceSu];
  $r_minprice = ($min1 + $min2 + $min3 + $min4) / $divide;
  $r_maxprice = ($max1 + $max2 + $max3 + $max4) / $divide;
      $MyPrice = number_format($r_minprice, 2, ".", ",");
  $MyPrice2 = number_format($r_maxprice, 2, ".", ",");

  $ListingTable .= "<br><strong>Price Range:</strong> $aset[Currencya]$MyPrice - $aset[Currencya]$MyPrice2 pw<br />\n";

      $ListingTable .= "</tr>\n";

      $ListingTable .= "<tr>\n\t<td colspan=4>$a1[shortDesc]</td>\n</tr>\n";

      $ListingTable .= "</table>\n\n</td>\n</tr>\n\n";

   }

   $ListingTable .= "</table>";

      $rnav = mysql_query($qnav) or die(mysql_error());
      $rows = mysql_num_rows($rnav);

         if($rows > $ByPage)
         {
            $ListingTable .=  "<br><table align=center width=100%>";
            $ListingTable .= "<td align=center><font face=verdana size=2> ";

            $pages = ceil($rows/$ByPage);

            for($i = 0; $i <= ($pages); $i++)
            {
               $PageStart = $ByPage*$i;

               $i2 = $i + 1;

               if($PageStart == $Start)
               {
                  $links[] = " <span class=RedLink>$i2</span>\n\t ";
               }
               elseif($PageStart < $rows)
               {
                  $links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&search_country=$_GET[search_country]&search_PropertyType=$_GET[search_PropertyType]&MinPrice=$_GET[MinPrice]&MaxPrice=$_GET[MaxPrice]&rooms1=$_GET[rooms1]&rooms2=$_GET[rooms2]&bath1=$_GET[bath1]&bath2=$_GET[bath2]&before=$_GET[before]&school=$_GET[school]&transit=$_GET[transit]&park=$_GET[park]&ocean_view=$_GET[ocean_view]&lake_view=$_GET[lake_view]&mountain_view=$_GET[mountain_view]&ocean_waterfront=$_GET[ocean_waterfront]&lake_waterfront=$_GET[lake_waterfront]&river_waterfront=$_GET[river_waterfront]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t ";
               }
            }

            //$links2 = implode(" | ", $links);

            //$ListingTable .= $links2;

            $ListingTable .= " </td>";

            $ListingTable .= "</table><br>\n";

         }
}

else
{
   $ListingTable = "<br><br><center>No results were found!</center>";
}
     }  }

 

Thanks,

Steve

Link to comment
Share on other sites

Ive changed round the code a bit but still cant get it to work right, i think im getting there but just cant seem to get it right. Anyone got any ideas?

 

Here is the new code

<?
require_once("conn.php");
require_once("includes.php");
if(!isset($_GET['page'])){ 
    $page = 1; 
} else { 
    $page = $_GET['page']; 
} 
$max_results = 10; 
$from = (($page * $max_results) - $max_results);
$query = array();

if(!empty($_GET[c]))
{
   $query[] = "re_listings.CategoryID = '$_GET[c]' ";
}

if(!empty($_GET[s]))
{
   $query[] = "re_listings.SubcategoryID = '$_GET[s]' ";
}

if(!empty($_GET[AgentID]))
{
   $query[] = "re_listings.AgentID = '$_GET[AgentID]' ";
}

if(!empty($_GET[search_country]))
{
   $query[] = "re_listings.country = '$_GET[search_country]' ";
}

if(!empty($_GET[search_state]))
{
   $query[] = "re_listings.state = '$_GET[search_state]' ";
}

if(!empty($_GET[search_city]))
{
   $query[] = "re_listings.city = '$_GET[search_city]' ";
}

if(!empty($_GET[search_PropertyType]))
{
   $query[] = "re_listings.PropertyType = '$_GET[search_PropertyType]' ";
}

if(!empty($_GET[MinPriceW]))
{
   $query[] = "re_listings.price >= '$_GET[MinPriceW]' ";
}

if(!empty($_GET[MaxPriceW]))
{
   $query[] = "re_listings.price <= '$_GET[MaxPriceW]' ";
}

if(!empty($_GET[MinPriceSp]))
{
   $query[] = "re_listings.price >= '$_GET[MinPriceSp]' ";
}

if(!empty($_GET[MaxPriceSp]))
{
   $query[] = "re_listings.price <= '$_GET[MaxPriceSp]' ";
}

if(!empty($_GET[MinPriceSu]))
{
   $query[] = "re_listings.price >= '$_GET[MinPriceSu]' ";
}

if(!empty($_GET[MaxPriceSu]))
{
   $query[] = "re_listings.price <= '$_GET[MaxPriceSu]' ";
}

if(!empty($_GET[MinPriceA]))
{
   $query[] = "re_listings.price >= '$_GET[MinPriceA]' ";
}

if(!empty($_GET[MaxPriceA]))
{
   $query[] = "re_listings.price <= '$_GET[MaxPriceA]' ";
}

if(!empty($_GET[rooms1]))
{
   $query[] = "re_listings.rooms >= '$_GET[rooms1]' ";
}

if(!empty($_GET[rooms2]))
{
   $query[] = "re_listings.rooms <= '$_GET[rooms2]' ";
}

if(!empty($_GET[bath1]))
{
   $query[] = "re_listings.bathrooms >= '$_GET[bath1]' ";
}

if(!empty($_GET[bath2]))
{
   $query[] = "re_listings.bathrooms <= '$_GET[bath2]' ";
}

if(!empty($_GET[before]))
{
   $MyDate = strtotime("-$_GET[before]");
   $query[] = "re_listings.DateAdded >= '$MyDate' ";
}

if(!empty($_GET[school]))
{
   $query[] = "re_listings.NearSchool = 'y' ";
}

if(!empty($_GET[transit]))
{
   $query[] = "re_listings.NearTransit = 'y' ";
}

if(!empty($_GET[park]))
{
   $query[] = "re_listings.NearPark = 'y' ";
}

if(!empty($_GET[ocean_view]))
{
   $query[] = "re_listings.OceanView = 'y' ";
}

if(!empty($_GET[lake_view]))
{
   $query[] = "re_listings.LakeView = 'y' ";
}

if(!empty($_GET[mountain_view]))
{
   $query[] = "re_listings.MountainView = 'y' ";
}

if(!empty($_GET[ocean_waterfront]))
{
   $query[] = "re_listings.OceanWaterfront = 'y' ";
}

if(!empty($_GET[lake_waterfront]))
{
   $query[] = "re_listings.LakeWaterfront = 'y' ";
}

if(!empty($_GET[river_waterfront]))
{
   $query[] = "re_listings.RiverWaterfront = 'y' ";
}

if(!empty($query))
{
   $MyQuery = implode(" and ", $query);

   $MyQuery = "and ".$MyQuery;
}


////////////////////////////////////////////////////////////
//////////     order by

$order = array();

if(!empty($_GET[orderby]))
{
   $MyOrder = explode("|", $_GET[orderby]);

   while(list(,$ov) = each($MyOrder))
   {
      if($ov == "DateAdded")
      {
         $order[] = " re_listings.DateAdded desc ";
      }
      
      if($ov == "Price")
      {
         $order[] = " re_listings.Price asc ";
      }
      
      if($ov == "address")
      {
         $order[] = " re_listings.address asc ";
      }

   }
}
else
{
   if(!empty($_GET[p]))
   {
      $order[] = " re_listings.Price asc ";
   }

   if(!empty($_GET[r]))
   {
      $order[] = " re_listings.rooms asc, re_listings.bathrooms asc, re_listings.garage asc ";
   }

   if(!empty($_GET[city]))
   {
      $order[] = " re_listings.city, re_listings.address, re_listings.state ";
   }

}


if(count($order) > '0')
{
   $MyOrder = implode(", ", $order);

}

if(empty($MyOrder))
{
   $MyOrder = " order by re_agents.PriorityLevel desc, re_listings.DateAdded desc";
}
else
{
   $MyOrder = " order by re_agents.PriorityLevel desc, $MyOrder";
}


if(!empty($_GET[start]))
{
   $Start = $_GET[start];
}
else
{
   $Start = '0';
}

$ByPage = '2';

if($aset[sitefee]=="1")
      {
$q1 = "select * from re_listings, re_agents where re_listings.AgentID = re_agents.AgentID and re_agents.AccountStatus = 'active' $MyQuery $MyOrder limit $from, $max_results";
$total_results = mysql_num_rows(mysql_query("select * from re_listings, re_agents where re_listings.AgentID = re_agents.AgentID  order by re_listings.DateAdded")); 
//echo $total_results;
$total_pages = ceil($total_results / $max_results);
      }
      else
      {
$q1 = "select * from re_listings, re_agents, re_priority where re_listings.AgentID = re_agents.AgentID and re_agents.PriorityLevel = re_priority.PriorityLevel and re_agents.AccountStatus = 'active' $MyQuery $MyOrder limit $from, $max_results";
$total_results = mysql_num_rows(mysql_query("select * from re_listings, re_agents, re_priority where re_listings.AgentID = re_agents.AgentID and re_agents.PriorityLevel = re_priority.PriorityLevel and re_agents.AccountStatus = 'active' $MyQuery $MyOrder")); 
//echo $total_results;
$total_pages = ceil($total_results / $max_results);
      
      }



$qnav = "select * from re_listings, re_agents where re_listings.AgentID = re_agents.AgentID $MyQuery";

$r1 = mysql_query($q1) or die(mysql_error());
$lrows = mysql_num_rows($r1);

$q2 = "select * from re_agents, re_listings where re_listings.ListingID = '$_GET[id]' and re_listings.AgentID = re_agents.AgentID ";
$r2 = mysql_query($q2) or die(mysql_error());
$a2 = mysql_fetch_array($r2);

if ($a2[PriorityLevel]=1)
    {
$ListingTable .= "<br>";

if($lrows > '0')
{

   $ListingTable .= "<table align=center width=90% border=1 background=images/search_bg.gif rules=rows cellspacing=0 style=\"border-collapse:collapse;\">\n";

   while($a1 = mysql_fetch_array($r1))
   {
   
      	$ListingTable .= "<tr style=\"border-width:1;border-color:blue\" onMouseOver=\"this.style.background='#ffffff'; this.style.cursor='hand'\" onMouseOut=\"this.style.background='images/search_bg.gif'\" onClick=\"window.open('info.php?id=$a1[ListingID]', '_top')\">\n\t";
      $ListingTable .= "<td height=60>";

      $ListingTable .= "<table align=center width=\"100%\">\n";
      

if($aset[sitefee]=="0")
      {
      $ListingTable .= "<caption align=center><span class=RedLink>$a1[rooms] bed-roomed $a1[PropertyType] in $a1[city], $a1[country]. Sleeps $a1[sleeps].</span></caption>\n";
      }

      $ListingTable .= "<tr>\n\t<td width=75>";

      if(!empty($a1[image]))
      {
         $images = explode("|", $a1[image]);
         $MyImage = $images[0];

         $ListingTable .= "<img src=\"re_images/$MyImage\" width=75 height=60 border=1>";
      }
      else
      {
         $ListingTable .= "<img src=\"no_image.gif\" border=1>";
      }

      $ListingTable .= "</td>\n\t";

      $ListingTable .= "<td width=225 valign=top><b>Property ID: $a1[ListingID]</b><br>$a1[address], $a1[city]<br>$a1[state], $a1[country]</td>\n\t";
      $ListingTable .= "<td width=100 valign=top>$a1[rooms] Bedroom(s),<br> $a1[bathrooms] bathroom(s)";

      $min1 = $a1[MinPriceW];
  $min2 = $a1[MinPriceSp];
  $min3 = $a1[MinPriceA];
  $min4 = $a1[MinPriceSu];
  $divide = 4;
  $max1 = $a1[MaxPriceW];
  $max2 = $a1[MaxPriceSp];
  $max3 = $a1[MaxPriceA];
  $max4 = $a1[MaxPriceSu];
  $r_minprice = ($min1 + $min2 + $min3 + $min4) / $divide;
  $r_maxprice = ($max1 + $max2 + $max3 + $max4) / $divide;
      $MyPrice = number_format($r_minprice, 2, ".", ",");
  $MyPrice2 = number_format($r_maxprice, 2, ".", ",");

  $ListingTable .= "<br><strong>Price Range:</strong> $aset[Currencya]$MyPrice - $aset[Currencya]$MyPrice2 pw<br />\n";
  
      $ListingTable .= "</tr>\n";

      $ListingTable .= "<tr>\n\t<td colspan=4>$a1[shortDesc]</td>\n</tr>\n";

      $ListingTable .= "</table>\n\n</td>\n</tr>\n\n";

   }


   $ListingTable .= "</table>";

      $rnav = mysql_query($qnav) or die(mysql_error());
      $rows = mysql_num_rows($rnav);

         if($rows > $ByPage)
         {
            $ListingTable .=  "<br><table align=center width=100%>";
            $ListingTable .= "<td align=center><font face=verdana size=2> ";

            $pages = ceil($rows/$ByPage);

            for($i = 0; $i <= ($pages); $i++)
            {
               $PageStart = $ByPage*$i;
   
               $i2 = $i + 1;
   
               if($PageStart == $Start)
               {
                  $links[] = " <span class=RedLink>$i2</span>\n\t ";
               }
               elseif($PageStart < $rows)
               {
                  $links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&search_country=$_GET[search_country]&search_PropertyType=$_GET[search_PropertyType]&MinPrice=$_GET[MinPrice]&MaxPrice=$_GET[MaxPrice]&rooms1=$_GET[rooms1]&rooms2=$_GET[rooms2]&bath1=$_GET[bath1]&bath2=$_GET[bath2]&before=$_GET[before]&school=$_GET[school]&transit=$_GET[transit]&park=$_GET[park]&ocean_view=$_GET[ocean_view]&lake_view=$_GET[lake_view]&mountain_view=$_GET[mountain_view]&ocean_waterfront=$_GET[ocean_waterfront]&lake_waterfront=$_GET[lake_waterfront]&river_waterfront=$_GET[river_waterfront]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t ";  
               }
            }

            //$links2 = implode(" | ", $links);
      
            //$ListingTable .= $links2;

            $ListingTable .= " </td>";

            $ListingTable .= "</table><br>\n";

         }
}
        }

// --------------------------------------------- PRIORITY CHANGE ---------------------------------------//

elseif ($a2[PriorityLevel]>=3)
     {
$ListingTable = "<br>";

        	if($lrows > '0')
{
   $ListingTable .= "<table align=center width=90% border=1 rules=rows cellspacing=0 style=\"border-collapse:collapse;\">\n";

   while($a1 = mysql_fetch_array($r1))
   {

      	$ListingTable .= "<tr style=\"border-width:1;border-color:blue\" onMouseOver=\"this.style.background='#ffffff'; this.style.cursor='hand'\" onMouseOut=\"this.style.background='#76cbeb'\" onClick=\"window.open('info.php?id=$a1[ListingID]', '_top')\">\n\t";
      $ListingTable .= "<td height=60>";

      $ListingTable .= "<table align=center width=\"100%\">\n";


if($aset[sitefee]=="0")
      {
      $ListingTable .= "<caption align=center><span class=RedLink><strong>$a1[rooms] bed-roomed $a1[PropertyType] in $a1[city], $a1[country]. Sleeps $a1[sleeps].</strong></span></caption>\n";
      }

      $ListingTable .= "<tr>\n\t<td width=75>";

      if(!empty($a1[image]))
      {
         $images = explode("|", $a1[image]);
         $MyImage = $images[0];

         $ListingTable .= "<img src=\"re_images/$MyImage\" width=75 height=60 border=1>";
      }
      else
      {
         $ListingTable .= "<img src=\"no_image.gif\" border=1>";
      }

      $ListingTable .= "</td>\n\t";

      $ListingTable .= "<td width=225 valign=top><b>Property ID: $a1[ListingID]</b><br>$a1[address], $a1[city]<br>$a1[state], $a1[country]</td>\n\t";
      $ListingTable .= "<td width=100 valign=top>$a1[rooms] Bedroom(s),<br> $a1[bathrooms] bathroom(s)";

      $min1 = $a1[MinPriceW];
  $min2 = $a1[MinPriceSp];
  $min3 = $a1[MinPriceA];
  $min4 = $a1[MinPriceSu];
  $divide = 4;
  $max1 = $a1[MaxPriceW];
  $max2 = $a1[MaxPriceSp];
  $max3 = $a1[MaxPriceA];
  $max4 = $a1[MaxPriceSu];
  $r_minprice = ($min1 + $min2 + $min3 + $min4) / $divide;
  $r_maxprice = ($max1 + $max2 + $max3 + $max4) / $divide;
      $MyPrice = number_format($r_minprice, 2, ".", ",");
  $MyPrice2 = number_format($r_maxprice, 2, ".", ",");

  $ListingTable .= "<br><strong>Price Range:</strong> $aset[Currencya]$MyPrice - $aset[Currencya]$MyPrice2 pw<br />\n";

      $ListingTable .= "</tr>\n";

      $ListingTable .= "<tr>\n\t<td colspan=4>$a1[shortDesc]</td>\n</tr>\n";

      $ListingTable .= "</table>\n\n</td>\n</tr>\n\n";

   }

   $ListingTable .= "</table>";

      $rnav = mysql_query($qnav) or die(mysql_error());
      $rows = mysql_num_rows($rnav);

         if($rows > $ByPage)
         {
            $ListingTable .=  "<br><table align=center width=100%>";
            $ListingTable .= "<td align=center><font face=verdana size=2> ";

            $pages = ceil($rows/$ByPage);

            for($i = 0; $i <= ($pages); $i++)
            {
               $PageStart = $ByPage*$i;

               $i2 = $i + 1;

               if($PageStart == $Start)
               {
                  $links[] = " <span class=RedLink>$i2</span>\n\t ";
               }
               elseif($PageStart < $rows)
               {
                  $links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&search_country=$_GET[search_country]&search_PropertyType=$_GET[search_PropertyType]&MinPrice=$_GET[MinPrice]&MaxPrice=$_GET[MaxPrice]&rooms1=$_GET[rooms1]&rooms2=$_GET[rooms2]&bath1=$_GET[bath1]&bath2=$_GET[bath2]&before=$_GET[before]&school=$_GET[school]&transit=$_GET[transit]&park=$_GET[park]&ocean_view=$_GET[ocean_view]&lake_view=$_GET[lake_view]&mountain_view=$_GET[mountain_view]&ocean_waterfront=$_GET[ocean_waterfront]&lake_waterfront=$_GET[lake_waterfront]&river_waterfront=$_GET[river_waterfront]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t ";
               }
            }

            //$links2 = implode(" | ", $links);

            //$ListingTable .= $links2;

            $ListingTable .= " </td>";

            $ListingTable .= "</table><br>\n";

}
}
}
else
{
   $ListingTable = "<br><br><center>No results were found!</center>";
} 

require_once("templates/HeaderTemplate.php");
?><div class="rbox"><div class="b"><div class="t"><?
require_once("templates/SearchTemplate.php");
?><br /></div></div></div><?
require_once("templates/FooterTemplate.php");

?>

 

And this is the main part of where it decides on the PriorityLevel

if ($a2[PriorityLevel]=1)
    {
$ListingTable .= "<br>";

if($lrows > '0')
{

   $ListingTable .= "<table align=center width=90% border=1 background=images/search_bg.gif rules=rows cellspacing=0 style=\"border-collapse:collapse;\">\n";

   while($a1 = mysql_fetch_array($r1))
   {
   
      	$ListingTable .= "<tr style=\"border-width:1;border-color:blue\" onMouseOver=\"this.style.background='#ffffff'; this.style.cursor='hand'\" onMouseOut=\"this.style.background='images/search_bg.gif'\" onClick=\"window.open('info.php?id=$a1[ListingID]', '_top')\">\n\t";
      $ListingTable .= "<td height=60>";

      $ListingTable .= "<table align=center width=\"100%\">\n";
      

if($aset[sitefee]=="0")
      {
      $ListingTable .= "<caption align=center><span class=RedLink>$a1[rooms] bed-roomed $a1[PropertyType] in $a1[city], $a1[country]. Sleeps $a1[sleeps].</span></caption>\n";
      }

      $ListingTable .= "<tr>\n\t<td width=75>";

      if(!empty($a1[image]))
      {
         $images = explode("|", $a1[image]);
         $MyImage = $images[0];

         $ListingTable .= "<img src=\"re_images/$MyImage\" width=75 height=60 border=1>";
      }
      else
      {
         $ListingTable .= "<img src=\"no_image.gif\" border=1>";
      }

      $ListingTable .= "</td>\n\t";

      $ListingTable .= "<td width=225 valign=top><b>Property ID: $a1[ListingID]</b><br>$a1[address], $a1[city]<br>$a1[state], $a1[country]</td>\n\t";
      $ListingTable .= "<td width=100 valign=top>$a1[rooms] Bedroom(s),<br> $a1[bathrooms] bathroom(s)";

      $min1 = $a1[MinPriceW];
  $min2 = $a1[MinPriceSp];
  $min3 = $a1[MinPriceA];
  $min4 = $a1[MinPriceSu];
  $divide = 4;
  $max1 = $a1[MaxPriceW];
  $max2 = $a1[MaxPriceSp];
  $max3 = $a1[MaxPriceA];
  $max4 = $a1[MaxPriceSu];
  $r_minprice = ($min1 + $min2 + $min3 + $min4) / $divide;
  $r_maxprice = ($max1 + $max2 + $max3 + $max4) / $divide;
      $MyPrice = number_format($r_minprice, 2, ".", ",");
  $MyPrice2 = number_format($r_maxprice, 2, ".", ",");

  $ListingTable .= "<br><strong>Price Range:</strong> $aset[Currencya]$MyPrice - $aset[Currencya]$MyPrice2 pw<br />\n";
  
      $ListingTable .= "</tr>\n";

      $ListingTable .= "<tr>\n\t<td colspan=4>$a1[shortDesc]</td>\n</tr>\n";

      $ListingTable .= "</table>\n\n</td>\n</tr>\n\n";

   }


   $ListingTable .= "</table>";

      $rnav = mysql_query($qnav) or die(mysql_error());
      $rows = mysql_num_rows($rnav);

         if($rows > $ByPage)
         {
            $ListingTable .=  "<br><table align=center width=100%>";
            $ListingTable .= "<td align=center><font face=verdana size=2> ";

            $pages = ceil($rows/$ByPage);

            for($i = 0; $i <= ($pages); $i++)
            {
               $PageStart = $ByPage*$i;
   
               $i2 = $i + 1;
   
               if($PageStart == $Start)
               {
                  $links[] = " <span class=RedLink>$i2</span>\n\t ";
               }
               elseif($PageStart < $rows)
               {
                  $links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&search_country=$_GET[search_country]&search_PropertyType=$_GET[search_PropertyType]&MinPrice=$_GET[MinPrice]&MaxPrice=$_GET[MaxPrice]&rooms1=$_GET[rooms1]&rooms2=$_GET[rooms2]&bath1=$_GET[bath1]&bath2=$_GET[bath2]&before=$_GET[before]&school=$_GET[school]&transit=$_GET[transit]&park=$_GET[park]&ocean_view=$_GET[ocean_view]&lake_view=$_GET[lake_view]&mountain_view=$_GET[mountain_view]&ocean_waterfront=$_GET[ocean_waterfront]&lake_waterfront=$_GET[lake_waterfront]&river_waterfront=$_GET[river_waterfront]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t ";  
               }
            }

            //$links2 = implode(" | ", $links);
      
            //$ListingTable .= $links2;

            $ListingTable .= " </td>";

            $ListingTable .= "</table><br>\n";

         }
}
        }

// --------------------------------------------- PRIORITY CHANGE ---------------------------------------//

elseif ($a2[PriorityLevel]>=3)
     {
$ListingTable = "<br>";

        	if($lrows > '0')
{
   $ListingTable .= "<table align=center width=90% border=1 rules=rows cellspacing=0 style=\"border-collapse:collapse;\">\n";

   while($a1 = mysql_fetch_array($r1))
   {

      	$ListingTable .= "<tr style=\"border-width:1;border-color:blue\" onMouseOver=\"this.style.background='#ffffff'; this.style.cursor='hand'\" onMouseOut=\"this.style.background='#76cbeb'\" onClick=\"window.open('info.php?id=$a1[ListingID]', '_top')\">\n\t";
      $ListingTable .= "<td height=60>";

      $ListingTable .= "<table align=center width=\"100%\">\n";


if($aset[sitefee]=="0")
      {
      $ListingTable .= "<caption align=center><span class=RedLink><strong>$a1[rooms] bed-roomed $a1[PropertyType] in $a1[city], $a1[country]. Sleeps $a1[sleeps].</strong></span></caption>\n";
      }

      $ListingTable .= "<tr>\n\t<td width=75>";

      if(!empty($a1[image]))
      {
         $images = explode("|", $a1[image]);
         $MyImage = $images[0];

         $ListingTable .= "<img src=\"re_images/$MyImage\" width=75 height=60 border=1>";
      }
      else
      {
         $ListingTable .= "<img src=\"no_image.gif\" border=1>";
      }

      $ListingTable .= "</td>\n\t";

      $ListingTable .= "<td width=225 valign=top><b>Property ID: $a1[ListingID]</b><br>$a1[address], $a1[city]<br>$a1[state], $a1[country]</td>\n\t";
      $ListingTable .= "<td width=100 valign=top>$a1[rooms] Bedroom(s),<br> $a1[bathrooms] bathroom(s)";

      $min1 = $a1[MinPriceW];
  $min2 = $a1[MinPriceSp];
  $min3 = $a1[MinPriceA];
  $min4 = $a1[MinPriceSu];
  $divide = 4;
  $max1 = $a1[MaxPriceW];
  $max2 = $a1[MaxPriceSp];
  $max3 = $a1[MaxPriceA];
  $max4 = $a1[MaxPriceSu];
  $r_minprice = ($min1 + $min2 + $min3 + $min4) / $divide;
  $r_maxprice = ($max1 + $max2 + $max3 + $max4) / $divide;
      $MyPrice = number_format($r_minprice, 2, ".", ",");
  $MyPrice2 = number_format($r_maxprice, 2, ".", ",");

  $ListingTable .= "<br><strong>Price Range:</strong> $aset[Currencya]$MyPrice - $aset[Currencya]$MyPrice2 pw<br />\n";

      $ListingTable .= "</tr>\n";

      $ListingTable .= "<tr>\n\t<td colspan=4>$a1[shortDesc]</td>\n</tr>\n";

      $ListingTable .= "</table>\n\n</td>\n</tr>\n\n";

   }

   $ListingTable .= "</table>";

      $rnav = mysql_query($qnav) or die(mysql_error());
      $rows = mysql_num_rows($rnav);

         if($rows > $ByPage)
         {
            $ListingTable .=  "<br><table align=center width=100%>";
            $ListingTable .= "<td align=center><font face=verdana size=2> ";

            $pages = ceil($rows/$ByPage);

            for($i = 0; $i <= ($pages); $i++)
            {
               $PageStart = $ByPage*$i;

               $i2 = $i + 1;

               if($PageStart == $Start)
               {
                  $links[] = " <span class=RedLink>$i2</span>\n\t ";
               }
               elseif($PageStart < $rows)
               {
                  $links[] = " <a class=BlackLink href=\"search.php?Start=$PageStart&c=$_GET[c]&s=$_GET[s]&AgentID=$_GET[AgentID]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&search_country=$_GET[search_country]&search_PropertyType=$_GET[search_PropertyType]&MinPrice=$_GET[MinPrice]&MaxPrice=$_GET[MaxPrice]&rooms1=$_GET[rooms1]&rooms2=$_GET[rooms2]&bath1=$_GET[bath1]&bath2=$_GET[bath2]&before=$_GET[before]&school=$_GET[school]&transit=$_GET[transit]&park=$_GET[park]&ocean_view=$_GET[ocean_view]&lake_view=$_GET[lake_view]&mountain_view=$_GET[mountain_view]&ocean_waterfront=$_GET[ocean_waterfront]&lake_waterfront=$_GET[lake_waterfront]&river_waterfront=$_GET[river_waterfront]&city=$_GET[city]&p=$_GET[p]&r=$_GET[r]\">$i2</a>\n\t ";
               }
            }

            //$links2 = implode(" | ", $links);

            //$ListingTable .= $links2;

            $ListingTable .= " </td>";

            $ListingTable .= "</table><br>\n";

}
}
}
else
{
   $ListingTable = "<br><br><center>No results were found!</center>";
} 

 

Thanks

Steve

Link to comment
Share on other sites

It is a search problem that i'm having, the script is not sorting out whether it needs to show a bold/highlighted ad or a normal ad. Its just showing up everything as Priority 1 not all the different ones.

also if there is nothing to show it doesn't even show up 'no results were found'

hope you are able to get what i mean.

 

Thanks

Steve

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.