I'm sure this is an easy quesion, probably syntax, but could someone tell me why i keep getting a
Unknown column 'Used' in 'where clause'
error with this script.
I'm trying to pass the values either 'New' or 'Used', with a link, then assign the value to $age, and then search my db for all the records where collumn cond = $age.
<?php
//$age=$_GET['age'];
$age = "Used";
$db = mysql_connect("localhost", "gunalley_lookup");
mysql_select_db("gunalley_guns");
$result = mysql_query("SELECT * FROM guns
WHERE cond
= $age",$db) or die(mysql_error());
if ($myrow = mysql_fetch_array($result)) {
do {
echo "<center><table border=\"1\" width=\"400\"><tr><td rowspan=3><img src=\"", $myrow["image"], "\"</td><td>", $myrow["manu"], "</td><td>", $myrow["modle"], "</td><td>", $myrow["cal"],"</td></tr>";
echo "<tr><td>", $myrow["cond"], "</td><td>", $myrow["clipNum"], " ", "</td></tr>";
echo "<tr><td colspan=\"3\" height=\"40\">", $myrow["notes"], "</td></tr></table><br>";
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
?>