can anyone help at all.
have a search form with 4 different ways of searching.
Type , category , keywords, and all templates
the first 2 are poplated from a database and populate correctly, and the "category" dropdown search works fine, as does the "keywords" and "all templates", but the "type" search returns no records at all, even though i know there is records within that field.
here is the code for the search form.
<form name="search" method="Post" action="adminsearch.php?type=type">
<B><FONT SIZE="2" COLOR="#FF6600">By Type </FONT></B><BR>
<SELECT NAME="type" size="1">
<?php
$sql = "SELECT Distinct type from templates order by type asc";
$recordset=$conn->
Execute($sql);
while(!$recordset->EOF)
{
$item = $recordset->fields[type];
echo "<option>$item</option> ";
$recordset->movenext();
}
?>
</SELECT>
<INPUT TYPE="SUBMIT" NAME="go" VALUE="Search"></form>
<form name="search" method="Post" action="adminsearch.php?type=category">
<B><FONT SIZE="2" COLOR="#FF6600">By Category (Please select a
category:)</FONT></B><BR>
<SELECT NAME="category" size="1">
<?php
$sql = "SELECT Distinct catname from templates order by catname asc";
$recordset=$conn->
Execute($sql);
while(!$recordset->EOF)
{
$item = $recordset->fields[catname];
echo "<option>$item</option>";
$recordset->movenext();
}
?>
</SELECT>
<INPUT TYPE="SUBMIT" NAME="go" VALUE="Search"></form>
<form name="search" method="Post" action="adminsearch.php?type=keyword">
<B><FONT SIZE="2" COLOR="#FF6600">By Keyword (Please enter a
keyword:)</FONT></B><BR>
<INPUT TYPE="TEXT" NAME="keyword" SIZE="17"> <INPUT TYPE="SUBMIT" NAME="go" VALUE="Search"></form>
<A HREF="adminsearch.php?type=all"><B><FONT SIZE="2" COLOR="#FF6600">Display
All</FONT></B></A> <B><FONT SIZE="2" COLOR="#FF6600">Website
templates</FONT></b> </td>
</tr>
</table>
</td>
and here is the code for the admin search page.
<?php
include("include/common.php");
include("include/main.php");
include("$config[template_path]/onlyheader.php");
include("$config[template_path]/onlysearch.php");
global $conn,$ID,$perpage;
$perpage=3;
if($page=="") $page=1;
if($page==0) $page=1;
$count=0;
echo "<center><table width=\"96%\" border=\"0\" cellspacing=\"2\">";
//echo "<tr><td width='25%'></td><td width='8%'></td><td width='25%'></td><td width='8%'></td><td width='25%'></td><td width='8%'></td></tr>";
echo "<tr><td width='35%'></td><td width='15%'></td><td width='35%'></td><td width='15%'></td></tr>";
echo "<tr>";
if($type==keyword)
{
$skip=$page*$config[listings_per_page]-$config[listings_per_page];
$sql = "Select Distinct tID,ID,active from keyword,templates where keyword='$keyword' and active='yes' and ID=tID order by tID asc";
$recordset=$conn->Selectlimit($sql,$skip);
$recordset->MoveLast();
$last=$recordset->fields[tID];
if($last=="") $last=0;
$sql="Select Distinct tID,ID,active from keyword,templates where keyword='$keyword' and active='yes' and ID=tID and tID>$last order by tID asc ";
$recordset=$conn->Selectlimit($sql,$config[listings_per_page]);
if($recordset==false)
echo "Error";
while(!$recordset->EOF)
{
$ID=$recordset->fields[tID];
echo "<td width='25%' valign='top' align='left'>";
renderimage($ID);
echo "<br>";
renderinfo($ID);
echo "</td>";
echo "<td width='8%' valign='top'>";
renderprice($ID);
echo "</td>";
$recordset->MoveNext();
$count+=1;
if($count%$perpage==0)
echo "</tr><tr>";
}
}
if($type==category)
{
$skip=$page*$config[listings_per_page]-$config[listings_per_page];
$sql="Select ID,active from templates where catname='$category' and active='yes' order by ID asc";
$recordset=$conn->Selectlimit($sql,$skip);
$recordset->MoveLast();
$last=$recordset->fields[ID];
if($last=="") $last=0;
$sql="Select ID,active from templates where catname='$category' and active='yes' and ID>$last ";
$recordset=$conn->Selectlimit($sql,$config[listings_per_page]);
if($recordset==false)
echo "Error";
while(!$recordset->EOF)
{
$ID=$recordset->fields[ID];
echo "<td width='25%' valign='top' align='left'>";
renderimage($ID);
echo "<br>";
renderinfo($ID);
echo "</td>";
echo "<td width='8%' valign='top'>";
renderprice($ID);
echo "</td>";
$recordset->MoveNext();
$count+=1;
if($count%$perpage==0)
echo "</tr><tr>";
}
}
if($type==type)
{
$skip=$page*$config[listings_per_page]-$config[listings_per_page];
$sql="Select ID from templates where type='$type' order by ID asc";
$recordset=$conn->Selectlimit($sql,$skip);
$recordset->MoveLast();
$last=$recordset->fields[ID];
if($last=="") $last=0;
$sql="Select ID from templates where type='$type' and ID>$last ";
$recordset=$conn->Selectlimit($sql,$config[listings_per_page]);
if($recordset==false)
echo "Error";
while(!$recordset->EOF)
{
$ID=$recordset->fields[ID];
echo "<td width='25%' valign='top' align='left'>";
renderimage($ID);
echo "<br>";
renderinfo($ID);
echo "</td>";
echo "<td width='8%' valign='top'>";
renderprice($ID);
echo "</td>";
$recordset->MoveNext();
$count+=1;
if($count%$perpage==0)
echo "</tr><tr>";
}
}
if($type==all)
{
$skip=$page*$config[listings_per_page]-$config[listings_per_page];
$sql="Select ID,active from templates where active='yes' order by ID asc";
$recordset=$conn->Selectlimit($sql,$skip);
$recordset->MoveLast();
$last=$recordset->fields[ID];
if($last=="") $last=0;
$sql="Select ID,active from templates where ID>$last and active='yes' order by ID asc";
$recordset=$conn->Selectlimit($sql,$config[listings_per_page]);
if($recordset==false)
echo "Error";
while(!$recordset->EOF)
{
$ID=$recordset->fields[ID];
echo "<td width='35%' valign='top' align='left'><div>";
renderimage($ID);
echo "<br>";
renderinfo($ID);
echo "</td>";
echo "<td width='15%' valign='top'>";
renderprice($ID);
echo "</td>";
$recordset->MoveNext();
$count+=1;
if($count%$perpage==0)
echo "</tr><tr><td colspan='4' background='images/5b.jpg'> </td></tr><tr>";
}
}
echo "</tr></table></center>";
echo "<table width=\"94%\" border=\"0\" cellspacing=\"2\">";
echo "<tr><td align=\"center\">";
generatenextprev();
echo "</td></tr></table>";
?>
<script language="javascript">
function MM_openBrWindow(theURL,winName) { //v2.0
window.open(theURL,winName,'width=800,height=600 ,status=no,location=no,buttons=0,scrollbars=yes');
}
function MM_openBrWindow2(theURL,winName) { //v2.0
window.open(theURL,winName,'width=400 ,height=425 ,status=no,location=no,buttons=0,scrollbars=yes');
}
</script>
if anyone can point me to where I am going wrong, that would be a great help.
Thanks in advance
Russ