Hi guys
Can anyone tell me what I’m doing wrong? Trying to get an ‘no match/result found’ message to appear when no data is returned from the search…
The best I can get is the loop working, but displaying no information instead of it saying no results…
[php] $keywordinput = $_POST[“keywordinput”];
$result = mysqli_query($con,"SELECT * FROM pdfs
WHERE Keywords LIKE '%$keywordinput%'");
echo "<h1>Showing results for " . $keywordinput . "</h1>"; //You would post whatever the user is searching here
$count = 0;
if ($result=="") {
echo ("No matches");
}
else {
while($row = $result->fetch_assoc()){
$count++;
echo "$count." . $row['THUMBNAIL'] . "<a href='http://www.bictechnology.co.uk/" . $row['FILENAME'] . "'>" . $row['Title'] . "</a><br />" . $row['description'] . "<br /><br />";
}
}
[/php]
have also tried this…
[php] if (!$result)
{
echo (“No matches”);
}
else {
while($row = $result->fetch_assoc()){
$count++;
echo "$count." . $row['THUMBNAIL'] . "<a href='http://www.bictechnology.co.uk/" . $row['FILENAME'] . "'>" . $row['Title'] . "</a><br />" . $row['description'] . "<br /><br />";
}
[/php]