Jump to content

min/max search results


Ninjakreborn

Recommended Posts

$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school' AND price > '$searchpricemin' AND price < '$searchpricemax';";
ok this was the search query, I have one in the db, with price of 80 just for a test
When I put in minimum of 70 maximum of 85 or 90 then it works
but when I put in, minimum of 70 maximum of 100 or higher, it doesn't bring search results, I need it to get everything within that minimum maximum range, what's going on.

EDIT
see I also just tried usin
$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school' AND price BETWEEN '$searchpricemin' AND '$searchpricemax';"
and it's not working right.  The min number and max numbers are also recieving the right values, it's just neither one seem to be working.
Link to comment
Share on other sites

[quote author=Barand link=topic=109078.msg439550#msg439550 date=1158947873]
What column type is the number column? If it is char or varchar, change it to a numeric type such as INT
[/quote]
If the colum is for prices, then INT type may not be a good idea, as there might be decimal points in the values.
Link to comment
Share on other sites

$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school' AND price BETWEEN $searchpricemin AND $searchpricemax";

but as said above if it is not 'int' in table then wont work.. also not sure if as they are int being checked if it needs to be surounded with '' or not
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.