PHP | MySQL Search
| From: | Andre \"Tuin\" Boontjes | Date: | Tue, 13 Mar 2001 15:35:39 +0000 |
| Subject: | PHP | MySQL Search | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-43669@lists.php.net to get a copy of this message | ||
Hya'll,
I've got a little problem with coding some php/mysql, this is what I have :
---------------------------------------------------------------------
Table Search
---------------------------------------------------------------------
HouseID | FacilityID | SurroundingID | PriceID | TypeID | CountryID |
---------------------------------------------------------------------
1 | 1 | 0 | 3 | 4 | 2 |
1 | 3 | 0 | 3 | 4 | 2 |
1 | 5 | 0 | 3 | 4 | 2 |
1 | 0 | 3 | 3 | 4 | 2 |
2 | 0 | 0 | 3 | 5 | 2 |
2 | 0 | 1 | 3 | 5 | 2 |
2 | 5 | 0 | 3 | 5 | 2 |
---------------------------------------------------------------------
Query 1 :
(I only want result on houses which are in country 2 and in price 3 and
facility 1 must be included on the spot)
I've used :
SELECT HouseID FROM Search WHERE CountryID='2' AND PriceID='3' AND
(FacilityID='5')
Result 1 :
HouseID 1 and HouseID 2 this one is right.
Query 2 :
(I only want result on houses which are in country 2 and in price 3 and
facility 1 and 5 must be included on the spot)
I've used :
SELECT HouseID FROM Search WHERE CountryID='2' AND PriceID='3' AND
(FacilityID='1' OR FacilityID='5')
Result 2 :
again HouseID 1 and HouseID 2, the problem here is that HouseID 2 doesn't
contain Facility 1.
The problem here is just that when I give more criteria to the query the
result is or equal or even bigger then when I give less criteria, it should
be just the other way around, that is I want a more detailed result, does
anyone have the solution for this problem ?
A. Boontjes aka Tuin (Tuin@TomDeeDom.com)
Web-developer at : www.TomDeeDom.com & www.Impression.nl
--
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me
spread!
--