Is it possible to search for results as partial words?
For example... I am currently looking up 2 fields in a basic form Brand and Name
How do i code the table so that i can search for "Hei" and "Tom Sou" and not have to search for Tomato Soup?
Can someone show me an example?
Current code
<?php
$connect = mysql_connect($dbServer,$dbUsername,$dbPassword);
if(!$connect){
die('Could not connect: '.mysql_error());
}
?>
<form action="" method="post">
Brand <input type="text" name="Brand" />Item <input type="text" name="Item" /><input type="submit" value="Submit" />
</form>
<?php
$Brand = mysql_real_escape_string($_REQUEST['Brand']);
$Item = mysql_real_escape_string($_REQUEST['Item']);
$sql = "SELECT * FROM DB WHERE item_brand LIKE '%".$brand."%' AND item_name LIKE '%".$item."%'";
$r_query = mysql_query($sql);
echo ('<table><tr><td>ID</td><td>Brand</td><td>Item</td></tr>');
while ($row = mysql_fetch_array($r_query)){
echo '<tr><td>' .$row['item_ID'].'</td>';
echo '<td>' .$row['item_brand'].'</td>';
echo '<td>'.$row['item_name'].'</td></tr>';
}
echo ("</table>");
?>