hi, im making a search script, the code i’m using is:
[code=php]
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<link rel=”stylesheet” type=”text/css” media=”screen” title=”Stylesheet” href=”styles.css”>
</head>
<body>
<!–START OF DIV CODE–>
<div id=”container”>
<div id=”header”>banner</div>
<div id=”menu”><?php include(‘menu.html’); ?></div>
<div id=”content-container”>
<div id=”content”>
<!– ALL CONTENT –>
<?
echo”
<table border=”1″ cellpadding=”0″ cellspacing=”0″ style=”border-collapse: collapse” bordercolor=”#111111″ width=”100%” id=”AutoNumber1″>
<tr>
<td class=”headers” width=”16%” align=”center”>File #</td>
<td class=”headers” width=”16%” align=”center”>Type Of Business</td>
<td class=”headers” width=”17%” align=”center”>Location</td>
<td class=”headers” width=”17%” align=”center”>Gross Revenue</td>
<td class=”headers” width=”17%” align=”center”>Business Price
</font></td>
<td width=”17%” align=”center”>Terms</td>
</tr>”;
//CONNECT TO MYSQL AND DATABASE
$conn=@mysql_connect(“localhost”, “USERNAME”, “PASSWORD”) or die (“Err:Conn”);
mysql_select_db(“majdkgf_capital1”) or die(“Err:Db”);
//CONVERT INFORMATION INTO VARIABLES
$category=$_POST[‘category’];
$keyword=$_POST[‘keyword’];
//FORM THE QUERY
$sql=”select * from businesses_for_sale where ‘$category’ LIKE ‘%$keyword%'”;
$result = mysql_query($sql,$conn);
//TEST IF THERE IS AN ERROR WITH QUERY
if(!$result) die(“query “.$query.” failed with error “.mysql_error());
$number=mysql_num_rows(mysql_query(“$sql”));
echo “Search has returned $number results “;
echo “In the category: $category”;
while ($row = mysql_fetch_array($result))
{
$filenu=$row[‘filenu’];
$Business=$row[‘Business’];
$Location=$row[‘Location’];
$Gross_Sales=$row[‘Gross_Sales’];
$Business_Price=$row[‘Business_Price’];
$Terms=$row[‘Terms’];
echo (”
<tr>
<td class=”result” width=”16%” align=”center”><a href=”http://www.majd-gfx.com/capital-one/show_full_business.php?full_business_file_number=$filenu”>$filenu</a></td>
<td class=”result” width=”16%” align=”center”>$Business</td>
<td class=”result” width=”17%” align=”center”>$Location</td>
<td class=”result” width=”17%” align=”center”>$Gross_Sales</td>
<td class=”result” width=”17%” align=”center”>$Business_Price</td>
<td class=”result” width=”17%” align=”center”>$Terms</td>
</tr>
“);
}
echo”</table> “; ?>
<!– END OF CONTENT –>
</div>
</div>
</div>
<!–END OF DIV CODE–>
</body>
</html>
now my question is, on my db, do all the fields have to be full text?
if not, this query is not showing any results even though im searching for exact match…..