Ninjakreborn Posted September 22, 2006 Share Posted September 22, 2006 I have a table called priceinside there, it's going to say a numberjust a regular numberthen for minimum maximum price the person can put30 70which 30 is minimum 70 is maximumthis is going to search in the database, for all the results within that range.???? Quote Link to comment https://forums.phpfreaks.com/topic/21674-minmax-search-results/ Share on other sites More sharing options...
redarrow Posted September 22, 2006 Share Posted September 22, 2006 somethink like this i say but only a guess.[code]$query="select price from table where like num='%".$num."%' and price > 30 or < 70 ";$result=mysql_query($query);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/21674-minmax-search-results/#findComment-96792 Share on other sites More sharing options...
Ninjakreborn Posted September 22, 2006 Author Share Posted September 22, 2006 $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 testWhen I put in minimum of 70 maximum of 85 or 90 then it worksbut 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.EDITsee 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. Quote Link to comment https://forums.phpfreaks.com/topic/21674-minmax-search-results/#findComment-96835 Share on other sites More sharing options...
Barand Posted September 22, 2006 Share Posted September 22, 2006 What column type is the number column? If it is char or varchar, change it to a numeric type such as INT Quote Link to comment https://forums.phpfreaks.com/topic/21674-minmax-search-results/#findComment-96868 Share on other sites More sharing options...
imartin Posted September 22, 2006 Share Posted September 22, 2006 [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. Quote Link to comment https://forums.phpfreaks.com/topic/21674-minmax-search-results/#findComment-96869 Share on other sites More sharing options...
Barand Posted September 22, 2006 Share Posted September 22, 2006 True, I was just going by his example data Quote Link to comment https://forums.phpfreaks.com/topic/21674-minmax-search-results/#findComment-96871 Share on other sites More sharing options...
shocker-z Posted September 22, 2006 Share Posted September 22, 2006 $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 Quote Link to comment https://forums.phpfreaks.com/topic/21674-minmax-search-results/#findComment-96874 Share on other sites More sharing options...
Ninjakreborn Posted September 22, 2006 Author Share Posted September 22, 2006 yes after fighting with it for like 3-5 hours I realized I needed it set to int, it was a big waste of time over something that wouldn't have happened, if I had of known that, I just didn't think about it having anything to do with db types, until at the end. Quote Link to comment https://forums.phpfreaks.com/topic/21674-minmax-search-results/#findComment-96876 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.