Hi all.......
first I will start with the layout of the database concerningt his question
PHP Code:users(uid, name, phone, address, email, website, premium, writeup, coupon)
category(cid, value)
lookup(uid, cid)
Now when I preform a search, it sometimes gets messed up when there a user belongs to multiple categories, indicated by the lookup table which links the two other tables together
for example if lookup looked like....
|uid | cid|
| 1 || 43 |
| 1 || 26 |
| 1 || 11 |
it would display the results 3 times... I know I need to use distinct, but I cant realy remember how to use it to well....this is hte statement I came up with
and its not working....PHP Code:$result =mysql_query("SELECT DISTINCT lookup.uid, lookup.cid, users.name, users.uid, users.phone, users.address, users.email, users.website, users.premium, users.writeup, users.coupon, category.* FROM users, lookup, category WHERE (((category.cid = lookup.cid) AND (lookup.uid = users.uid)) AND ((users.name LIKE '%$keyword%') or (category.value LIKE '%$keyword%'))) ORDER BY premium DESC, name ASC LIMIT $offset, $x")
it still brings up all of hte results



it still brings up all of hte results



Bookmarks