Hi This is the php code I used:
<html>
<head><title>processform</title>
</head>
<body>
<?php
// include MySQL-processing classes
$var = @$_GET['q'];
$trimmed = trim($var);
// connect to MySQL
$dbhost = "db.db.xxxxxxx.abc.com";
$dbname = "dbname";
$dbuser = "dbuser";
$dbpass = "password";
$link = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('dbname');
if (!$db_selected) {
die('Could not select database: ' . mysql_error());
}
$keyword = mysql_real_escape_string($_POST['keyword']);
// Perform the fulltext search
$sql = "SELECT productID, ArtistName, year, Genre, TypeOfDisc, Price, image
FROM searches WHERE MATCH(ArtistName) AGAINST ('$keyword' IN BOOLEAN MODE)
LIMIT 0 , 30";
$query = mysql_query($sql) or die(mysql_error());
$row_sql = mysql_fetch_assoc($query);
$total = mysql_num_rows($query);
if($total>0) {
while ($row_sql = mysql_fetch_assoc($query)) {//echo out the results
echo ''.$row_sql['ArtistName'].'<br />'.$row_sql['Price'].'';
}
} else
{
echo '<div class="maincontainer"><h2>No results were found, Go
back and try a new search.</h2></div>'.'';
}
echo '</div>';
?>
</body>
</html>
This is the HTML Code I used:
<form method="get" action="processform.php">
<div style="display:inline-block; width: 270px; overflow:hidden;"></div>
<input name="searchterm" type="text" size="55" class="searchbox" title="What service are you looking for ?" value="What service are you looking for ?" width="445px" />
<input type="submit" name="search" title="Search Now!
"value="Search" class="searchbutton" /> </div>
</form>
It gives me the error message that is in the Code " No results were found, Go back and try a new search."
However, it gives the same message no matter what I search for, even for words I know are in the DB.
Can someone please help
Thanks in advance🙂