searching trought multiple tables
| From: | Daniel Masur | Date: | Mon, 17 Sep 2001 14:21:22 +0000 |
| Subject: | searching trought multiple tables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-67604@lists.php.net to get a copy of this message | ||
i have a mysql database with 100 entrys in 3 tables.
i need to search trought them, but if i search for 'a' in all tables, i get
5000 results...
70 results are the same.
heres my code:
$sql_find="
SELECT
mieter.miet_name, mieter.cat_id, mieter.id,
mieter.miet_beschreibung, cat.cat_name, events.name
FROM
mieter AS mieter,
categories AS cat,
events AS events
WHERE
mieter.miet_name LIKE '%$words%'";
if($option1) $sql_find = $sql_find . " AND mieter.cat_id = '$option1'";
$sql_find = $sql_find . " OR mieter.miet_beschreibung LIKE '%$words%'";
$sql_find = $sql_find . " or events.name LIKE '%$words%'";
with $option1 enabled you can search trought subcategories. can anybody help
me?