Jump to content

Query not working


interpim

Recommended Posts

Hi all,

 

I have a form which has a bunch of drop down boxes to select from.... these submit to a results page which runs a query into a database I have.

 

The problem I am having is I have a field called min_level which is an integer, and the form lets teh user select between levels to search for... so for instance, my user wants to find something with a min_level between 5 and 15 I want only the items which have a number between that to show up in the query.

 

The problem is, I am getting all results as long as the query goes from 0 to the max allowable amount,

when I adjust the settings I am getting back odd results, as in nothing showing up, or only certain ones.

 

the script I have basically goes like this

 

$sql = "Select * From items where career = '$career'";

if($min_lvl != ''){
$sql = $sql . " and min_level >= $min_lvl";
}
if($max_lvl != ''){
$sql = $sql . " and =< $max_lvl";
}


 

The reason I am using the statements is to give the user the option of using more or less search features for an item database I am building for an online video game.

 

If anyone could square me away I would appreciate it :)

Link to comment
https://forums.phpfreaks.com/topic/117043-query-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.