I understand what your doing with the code now and how it works.
i used your method and changed around my values etc.
now when i run it i get an error:
Warning: Supplied argument is not a valid MySQL result resource in /var/www/html/php/parts2withmenu2.php
any ideas?...here is the code:
<FORM ACTION="parts2.php" METHOD=POST>
<P>Select Manufacturer:
<P>
<select name="selectname">
<option value="ab_dick">AB DICK</option>
<option value="itek">ITEK</option>
<option value="multigraphics_1">MULTIGRAPHICS 1</option>
<option value="multigraphics_2">MULTIGRAPHICS 2</option>
<option value="ryobi">RYOBI</option>
<option value="townsend">TOWNSEND</option>
</select>
<P>
<P>Keywords:<br>
<input type=text name="search" size=30>
<p><input type=submit name="submit" value="Search"></p>
</FORM>
<?
$conn = mysql_connect("localhost", "user", "pass") or die("Could not connect");
mysql_select_db("T51partsDB",$conn) or die ("Could not connect to the Database");
$color1 = "#66CCCC";
$color2 = "#999999";
$newArray_count = 0;
$sql = "select ITEM, DESCRIPTION, UOM, QTY_PER_PCKG, LIST_PRICE, NOTES from $selectname like '%$search%'";
?>
<TABLE BORDER="0" WIDTH="60%" CELLPADDING="1">
<?
$result = mysql_query($sql, $conn);
$number_of_rows = mysql_numrows($result);
if ($number_of_rows == 0) {
echo "No Results Found!";
exit;
}
echo "$number_of_rows matches found for your search of <b>$search</b>!";
echo "<TR><TD><b>Item #</b></td>
<TD><b>Description</b></td>
<TD><b>UOM</b></td>
<TD><b>Qty</b></td>
<TD><b>List Price</b></td>
<TD><b>Notes</b></td>
</tr>";
while ($newArray = mysql_fetch_array($result)) {
$id = $newArray['ID'];
$item = $newArray['ITEM'];
$desc = $newArray['DESCRIPTION'];
$uom = $newArray['UOM'];
$qty = $newArray['QTY_PER_PCKG'];
$price = $newArray['LIST_PRICE'];
$notes = $newArray['NOTES'];
$newArray_color = ($newArray_count%2)?$color1:$color2;
echo "<TR><tr bgcolor= $newArray_color ><TD> $item </TD> <TD> $desc </TD> <TD> $uom </TD> <TD> $qty </TD> <TD> $price </TD> <TD> $notes </TD></TR>";
$newArray_count++;
}
?>