http://www.blizzardnexus.com/itemDB/search.php3
I am working on a database and this is the search function. I got the searching by 'damage' working, but searching by defense isnt working and it's almost exactly the same line except 'dmg' is 'def' which is the only difference between all the variables relating to them.
here's an excerpt from the code:
// Searching by Damage
elseif($search_by == "dmg" && $advancedsearch == "yes"){
$resultID = mysql_query("SELECT * FROM items WHERE 'min_dmg' >= $min_dmg AND 'max_dmg' <= $max_dmg", $link);
print ( "<!-- Error occured: " . mysql_error() . " -->");
print "<p>\n<table border=0 width=100%>\n";
print "<tr>\n";
print "<td>Name</td>\n";
print "<td>Type</td>\n";
print "<td>Stat</td>\n";
print "</tr>\n";
for($x = 0; $x < mysql_num_rows($resultID); $x++)
{
print ( "<!-- Error occured: " . mysql_error() . " -->");
$row = mysql_fetch_assoc($resultID);
print "<tr>\n";
print "<td><a href=\"viewitem.php3?name=" . $row[name] . "\"><b>" . $row[name] . "</b>\n";
print "<td>" . $row[type] . "</td>\n";
print "<td>Dmg: " . $row[min_dmg] . " - " . $row[max_dmg] . "</td>\n";
print "</tr>\n";
}
print "</table>\n";
print ( "<!-- Error occured: " . mysql_error() . " -->");
}
// Searching by Defense
elseif($search_by == "def" && $advancedsearch == "yes"){
$resultID = mysql_query("SELECT * FROM items WHERE 'min_def' >= $min_def AND 'max_def' <= $max_def", $link);
print ( "<!-- Error occured: " . mysql_error() . " -->");
print "<p>\n<table border=0 width=100%>\n";
print "<tr>\n";
print "<td>Name</td>\n";
print "<td>Type</td>\n";
print "<td>Stat</td>\n";
print "</tr>\n";
for($x = 0; $x < mysql_num_rows($resultID); $x++)
{
print ( "<!-- Error occured: " . mysql_error() . " -->");
$row = mysql_fetch_assoc($resultID);
print "<tr>\n";
print "<td><a href=\"viewitem.php3?name=" . $row[name] . "\"><b>" . $row[name] . "</b>\n";
print "<td>" . $row[type] . "</td>\n";
print "<td>Dmg: " . $row[min_dmg] . " - " . $row[max_dmg] . "</td>\n";
print "</tr>\n";
}
print "</table>\n";
print ( "<!-- Error occured: " . mysql_error() . " -->");
}
The comments are for debugging.
I would appreciate any and all help.
Thanks in advance,
Thomas Le