December 30th, 1999, 10:19 AM
-
Does anybody know how to eliminate redundant search links?
If you go to http://johnny.ncolorado.com/index.php3 and do a keyword search on "real estate" you will see that it brings up the same link multiple times. It would be cool if it only brought up one from each company.
Any help would be appreciated. Thanks a ton.
Here's the code:
The code is here: http://johnny.ncolorado.com/searchresults.txt
December 31st, 1999, 12:28 PM
-
Knee-jerk reaction would be to say that you might be performing a cross join (a.k.a. Cartesian join) where all the rows of one table are being matched with every row in the other table as a result of as a result of not specifiying the correct condition in the where clause. This might help $sql="select t1.*, t2.* from companies as t1, location as t2 where t1.site_id=t2.site_id and t1.site_id IN (list the site id numbers here that you want to base your search on)" -> try this instead of the LEFT JOIN sql statement you have in there. Also, after briefly looking at your code, is was wondering about the following statement: $sql = "SELECT site_id,category_id,priority,coname,siteurl,sitedescription,category_id IN(category, numbers, here) FROM companies" -> in this case, category_id IN(category, numbers, here) will return every row and either a 1 or 0 for that column depending on whether that category number was found there (1) or not found there (0) it WILL NOT return only those containing the specified category number list. Try "select site_id, category_id, etc. from companies where category_id IN(category, numbers, here)"
I hope this helps. Happy New Year
Kyuzo