Hi, guys!
I don't know what the heck is going on here... I have the website
http://www.churchdirectoryworld.com but the search feature doesn't work.
You SHOULD be able to have it function like this website here:
http://worldwidechurchdirectory.com
But it doesn't!
In my MySQL Admin, I have something that says:
"No index defined!"
Is this a common symptom of two different versions of MySQL?
If it is, how do I fix it?
Any ideas?
Please help...
<?
require_once("conn.php");
require_once("includes.php");
require_once("templates/HeaderTemplate.php");
require_once("advanced.php");
require_once("templates/AdvancedSearchTemplate.php");
//Check for subcategories
if($_GET[c])
{
$catq="select * from yellow_subcat where rootcatid='$_GET[c]' order by subcatname asc";
$cats=mysql_query($catq);
if(mysql_num_rows($cats)!=0)
{ ?>
<table align=center width=100% border=0 bordercolor=#eee rules=rows cellspacing=3 cellpadding="2">
<tr align="center">
<td width=425 valign=top colspan=3 align="left" ><font face=verdana size=2><b>Select
a SubCategory</b></font> </td>
</tr>
<tr style="border-width:1; border-color:blue" onMouseOver="this.style.background='#FFFFCC'; this.style.cursor='hand'"
onMouseOut="this.style.background='white'" align="center">
<?
//Check for rows and columns
$counted=1;
while($catsl = mysql_fetch_array($cats))
{
?>
<td width=425 valign=top align="left"> <a href="search.php?s=<?=$catsl[subcatid]?>" class="style1">
<?=$catsl[subcatname]?>
</a></td>
<?if($counted%3==0){?></tr> <tr style="border-width:1; border-color:blue" onMouseOver="this.style.background='#FFFFCC';
this.style.cursor='hand'" onMouseOut="this.style.background='white'" align="center"><?}?>
<?
$counted=$counted+1;
}
?>
</tr>
</table>
<?}
else
{
echo "No Subcategories were found!";
}
}
else
{
$query = array();
if(!empty($_GET[c]))
{
$query[] = "yellow_agents.CategoryID = '$_GET[c]' ";
}
if(!empty($_GET[CategoryID]))
{
$query[] = "yellow_agents.CategoryID = '$_GET[CategoryID]' ";
}
if(!empty($_GET[s]))
{
$query[] = "yellow_agents.SubCategoryID = '$_GET[s]' ";
}
if(!empty($_GET[search_country]))
{
$query[] = "yellow_agents.country = '$_GET[search_country]' ";
}
if(!empty($_GET[search_state]))
{
$query[] = "yellow_agents.state = '$_GET[search_state]' ";
}
if(!empty($_GET[search_city]))
{
$query[] = "yellow_agents.city = '$_GET[search_city]' ";
}
if(!empty($_GET[search_kw]))
{
$query[] = " (yellow_agents.resume like '%$_GET[search_kw]%' or yellow_agents.CompanyName like '%$_GET[search_kw]%') ";
}
if(!empty($_GET[zip]))
{
$query[] = " (yellow_agents.zipcode like '%$_GET[zip]%') ";
}
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[] = " yellow_agents.RegDate desc ";
}
if($ov == "address")
{
$order[] = " yellow_agents.address asc ";
}
}
}
else
{
if(!empty($_GET[p]))
{
$order[] = " yellow_agents.RegDate desc ";
}
}
if(count($order) > '0')
{
$MyOrder = implode(", ", $order);
}
if($aset[Sitefee]=="0")
{
if(empty($MyOrder))
{
$MyOrder = " order by yellow_agents.AgentID desc, yellow_agents.RegDate desc";
}
else
{
$MyOrder = " order by yellow_agents.AgentID desc, $MyOrder, yellow_agents.RegDate desc";
}
}
if(!empty($_GET[Start]))
{
$Start = $_GET[Start];
}
else
{
$Start = '0';
}
$ByPage = '20';
if($aset[Sitefee]=="1")
{
$q1 = "select * from yellow_agents, yellow_categories,yellow_subcat where yellow_agents.CategoryID = yellow_categories.CategoryID
and yellow_agents.AccountStatus = 'active' and yellow_agents.SubCategoryID = yellow_subcat.subcatid $MyQuery $MyOrder limit $Start,
$ByPage ";
$qnav = "select * from yellow_agents, yellow_categories where yellow_agents.CategoryID = yellow_categories.CategoryID and
yellow_agents.AccountStatus = 'active' $MyQuery";
}
else
{
/*$q1 = "select * from yellow_agents, yellow_priority, yellow_categories,yellow_subcat where yellow_agents.CategoryID =
yellow_categories.CategoryID and yellow_agents.PriorityLevel = yellow_priority.PriorityLevel and yellow_agents.AccountStatus =
'active' and yellow_agents.SubCategoryID = yellow_subcat.subcatid $MyQuery $MyOrder limit $Start, $ByPage ";
$qnav = "select * from yellow_agents, yellow_priority, yellow_categories where yellow_agents.CategoryID = yellow_categories.CategoryID
and yellow_agents.PriorityLevel = yellow_priority.PriorityLevel and yellow_agents.AccountStatus = 'active' $MyQuery";*/
$q1 = "select * from yellow_agents, yellow_categories,yellow_subcat where yellow_agents.CategoryID = yellow_categories.CategoryID
and yellow_agents.AccountStatus = 'active' and yellow_agents.SubCategoryID = yellow_subcat.subcatid $MyQuery $MyOrder limit $Start,
$ByPage ";
$qnav = "select * from yellow_agents, yellow_categories where yellow_agents.CategoryID = yellow_categories.CategoryID and
yellow_agents.AccountStatus = 'active' $MyQuery";
}
$r1 = mysql_query($q1) or die(mysql_error());
$lrows = mysql_num_rows($r1);
if($lrows > '0')
{
$ListingTable .= "<table align=center width=100% border=1 bordercolor=#e3e3e3 rules=rows cellspacing=0>\n";
while($a1 = mysql_fetch_array($r1))
{
$rate="SELECT avg(rated) as abcde FROM yellow_rating where mediaid ='$a1[AgentID]' GROUP BY mediaid";
$rank="";
$rateq=mysql_query($rate)or die($rate);
$rateline=mysql_fetch_array($rateq);
$count=1;
while($count<=round($rateline[abcde]))
{
$rank.= "<img src=\"images/star_yellow.png\">";
$count=$count+1;
}
$ListingTable .= "<tr style=\"border-width:1; border-color:blue\" onMouseOver=\"this.style.background='#FFFFCC';
this.style.cursor='hand'\" onMouseOut=\"this.style.background='white'\" onClick=\"window.open('info.php?id=$a1[AgentID]',
'_top')\">\n\t";
$ListingTable .= "<td height=60>";
$ListingTable .= "<table align=center width=\"100%\" border=0>\n";
$ListingTable .= "<caption align=center>";
if($aset[Sitefee]=="0")
{
if(!empty($a1[PriorityLevel]))
{
$ListingTable .= "\n";
}
}
$ListingTable .= "<tr>";
/* if(!empty($a1[logo]))
{
$MyImage = $a1[logo];
$ListingTable .= "<img src=\"yellow_images/$MyImage\" width=75 height=60 border=1>";
}
else
{
$ListingTable .= "<img src=\"no_logo.jpg\" border=1>";
}
*/
//$ListingTable .= "</td>\n\t";
$ListingTable .= "<td width=425 valign=top><b>$a1[CompanyName]</b><br>Category: <a href=\"search.php?c=$a1[CategoryID]\"
class=SubCatLinks>$a1[CategoryName]</a>>><a href=\"search.php?s=$a1[subcatid]\" class=SubCatLinks>$a1[subcatname]</a></td>\n\t<td
width=200 valign=top>$rank<br>$a1[city], $a1[state] $a1[country]<td></tr>\n";
$ShortDesc = substr($a1[DetailedDesc], 0, 200);
if(!empty($ShortDesc))
{
$ListingTable .= "<tr>\n\t<td colspan=2>$ShortDesc</td>\n</tr>\n";
}
$ListingTable .= "</table>\n\n</td>\n</tr>\n\n";
}
$rnav = mysql_query($qnav) or die(mysql_error());
$rows = mysql_num_rows($rnav);
if($rows > $ByPage)
{
$ListingTable .= "<br><table align=center width=580>";
$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]&search_city=$_GET[search_city]&search_state=$_GET[search_state]&search_country=$_GET[search_country]&search_kw=$_GET[search_kw]\">$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>";
}
}
include("templates/SearchTemplate.php");
include("templates/FooterTemplate.php");
?>
|