okay, so i managed it to get up to 'sorry there are no results' but im wondering why it wont pull up any of my results.. here is what i have:
<?php
$db = mysql_connect("host", "user", "pw");
mysql_select_db("show19",$db);
if ($search)
{
$search = trim($search);
$search = explode(" ", $search);
}
$selectquery = "SELECT * FROM INTERNET";
if (isset($search))
{
$selectquery .= " WHERE ";
for($i = 0; $i < count($search); $i++)
{
$selectquery .= "'ITEM DESCRIPTION' LIKE '%" . $search[$i] . "%'";
if ($i < count($search)-1)
{
$selectquery .= " AND ";
}
}
}
$result = mysql_query("$selectquery",$db);
if ($list = mysql_fetch_array($result)) {
echo "<table border=1>\n";
echo "<tr><td><b>SKU</td><td><b>Item</td><td><b>Price</b></td></tr>\n";
do {
printf("<tr><td>%s</td><td>%s</td><td>$ %s</tr>\n", $list["SKU"], $list["ITEM DESCRIPTION"], $list["LOW PRICE"]);
} while ($list = mysql_fetch_array($result));
echo "</table>\n";
} else {
echo "Sorry, no records were found!";
}
?>
results are never found.. here is how my database is layed out. the data is in a table called database called show19 in a table called INTERNET. I am trying to do a search through a varchar field called ITEM DESCRIPTION and spit out the results while showing the SKU, ITEM DESCRIPTION, and PRICE. All of the entrys in each field are all caps. Is this case sensitive? I have tried both ways and neither work. Is there something wrong in the query? Basically what i watn to happen is if a user types in: 'Pearl' it would spit back a result called USED PEARL SNARE or PEARL MAPLE SNARE. Any suggestions?