Jump to content

HELP, very little time left


businessman332211@hotmail.com

Recommended Posts

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

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

can someone please help, I have to get this project finished today but thanks to this I won't. I don't thinkit's not searching properly, if the number is like 80, and my min is 70 and max is 95 it returns it, but if I go too high or low from the numbers it doesn't likeminimum- 50maximum- 200then it doesn't return it, what's going on. It's to search the price between a specific range.

Link to comment
Share on other sites

still didn't work, the one in there for testing is 80, even if I go show much as a little off on min/max it's not reading itminimum 50 maximum 100it doesn't read it because hte minimum is 50, what's going on.This is what I am using now.$select = "SELECT * FROM $postset WHERE categoryname = '$category' AND subcategoryname = '$subcategory' AND schoolname = '$school' AND price BETWEEN '$searchpricemin' AND '$searchpricemax';";

Link to comment
Share on other sites

what database are you using? MySql? is ...AND '$searchpricemax';"; really necessary? try this ...AND '$searchpricemax'"; I doubt MySql requires the ; after the sql statement.The time I have seen that needed is working ont he command line

Link to comment
Share on other sites

I tried taking that out but it's still not working, I am using mysql, i can't believe this, thanks to this I won't get the bonus for finishing it today, this is really aggravating, I thought I was using it like it was suppose to be used.Even when I blatantly told it, return search results were price was greater than the minimum, but less than the maximum, it still didn't work, I really don't understand this.

Link to comment
Share on other sites

hahaha I think I see the problemprice BETWEEN '$searchpricemin' AND '$searchpricemax'";do this instead

price BETWEEN $searchpricemin AND $searchpricemax";

You are telling the query that your numbers are strings so it is doing an alphabetical search80 = 'eighty' 50 = 'fifty'in this case 50 comes after 80 :)

Link to comment
Share on other sites

what database are you using? MySql? is ...AND '$searchpricemax';"; really necessary? try this ...AND '$searchpricemax'"; I doubt MySql requires the ; after the sql statement.The time I have seen that needed is working ont he command line
There seems to be a little confusion with regard to this, and since I just noticed this myself, from http://www.php.net/manual/en/function.mysql-query.php :
The query string should not end with a semicolon.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...