Is there a way by which i can have the results seperated in to sections
so that on screen at the top of each type there will be the title for each, i.e memory, graphics cards, processors etc etc.
the database filed that stores these is called 'product_type_description'
from the table 'products'
any ideas?
please let me know what would be the most suitable way to tackle this.
<?php
include('includes/misc.inc');
//You should now this but be sure to connect to your database or this is useless. :/
if ($search == "")
{$search = '%';}
$result = mysql_query ("SELECT * FROM products WHERE product_type_description LIKE '%$search%' OR
product_name LIKE '%$search%' OR product_description LIKE '%$search%' ")
or die('ERROR :'.sql_error()); // just to check it's OK
if(mysql_num_rows($result) == 0){
//This is the section that should be displayed when no results are avaialble from search
$OK = "Sorry, no records were found!";
echo "<table align='center' width='370' class='nosearchresults'><tr>";
echo "<td rowspan='2' valign='top'>";
echo "<img src='images/error_warning.gif' width='64' height='58'>";
echo "</td><td width='355' height='' valign='top' class='nosearchheading'>";
echo $OK;
echo "<br></td><td> </td>";
echo "<tr><td class='nosearchresultscontent'>";
echo "Try using less keywords or searching for different keywords altogether.";
echo "</p><p>";
echo "Alternatively you could try the quick find menu to the top-right of the screen or browse by product categories..";
echo "</p></td><td> </td></tr></table>";
}else{
//This is the section that displays the search results
echo "<span class='allresultsheadings'>Search Results:</span>";
while ($row = mysql_fetch_array($result)) {
echo "<table cellpadding='0' cellspacing='2' border='0' width='524'>";
echo "<tr><td class='productsdisplayedimageborder'><img src='images/thumbnail_images/{$row['product_thumbnail_image']}'></td>";
echo "<td class='productsdisplayedbackground' valign='top'> <a href='viewitem.php?product_item=".urlencode($row['product_id'])."'>".
htmlentities($row['product_name'])."</a> <br> <span class='productsdisplayeddescription'>".
htmlentities($row['product_description'])." </span> </td>";
echo "<td class='productsdisplayedprice' width='62'>".
htmlentities($row['product_price']). "</td></tr>";
echo "</table>";}
}?>