Results 1 to 1 of 1
Thread: Problems with a search quiry!
May 7, 2003, 18:01 #1
- Join Date
- Feb 2001
- 0 Post(s)
- 0 Thread(s)
Problems with a search quiry!
I am having problems with an search quiry for an classifieds script (zClassified).
The problem is to join 3 different tables and do a search quiry for the result.
I have made a search form where I have the following fields:
1. Subject and Description (type=text, name=keywords)
2. City (type=text, name=city)
3. Country (type=select, name=country)
4. Category (type=select, name=category)
1. ads : user_id, subject, descript ++
2. user : user_id, country ++
3. category : root_id, cat_name ++
$result = mysql_query( "SELECT * FROM ads LEFT JOIN user ON ads.user_id=user.user_id WHERE subject LIKE '%$keywords%' OR descript LIKE '%$keywords%' OR city LIKE '%$city%' AND country = '$country' AND cat_name = '$cat_name' ORDER BY add_date DESC" )or error( mysql_error() );
This code is all I have been able to make. I am sure there are some mistakes in there
PS! Sorry for not using the code tags, but I am having problems with the WYSIWYG thing [img]images/smilies/mad.gif[/img]
Last edited by Shantra; May 7, 2003 at 19:00.