Submerged Posted December 23, 2006 Share Posted December 23, 2006 It seems like this would be a common question, but searching through the forums hasn't turned up exactly what I'm looking for. Basically, I have a table names "sites", and 2 of the columns in there are named "name", and "description". I then have a query to search for a specific term.I have the query itself down just fine, when I'm just searching the "name" column:[code=php:0]SELECT * FROM sites WHERE name LIKE '%$term[0]%' AND name LIKE '%$term[1]%' AND category IN ('1','2','3','4','5','6','7','8','9')[/code]Which works just fine, but I also need to it to search through the "description" category in the same way as the "name" one (which includes the neccesary "category IN" part).I'm relatievly new to MYSQL, so I'm not sure how to process the syntax in that, but if someone could give me a hand it would be really great :)-Alex Link to comment https://forums.phpfreaks.com/topic/31636-solved-searching-2-columns-on-the-same-table-for-the-same-search-terms/ Share on other sites More sharing options...
artacus Posted December 23, 2006 Share Posted December 23, 2006 So just change the column from "name" to "description" Link to comment https://forums.phpfreaks.com/topic/31636-solved-searching-2-columns-on-the-same-table-for-the-same-search-terms/#findComment-146796 Share on other sites More sharing options...
Submerged Posted December 23, 2006 Author Share Posted December 23, 2006 It was a bit more than that, but since you told me about the union in the other thread i dont need this code anymore, thanks :) Link to comment https://forums.phpfreaks.com/topic/31636-solved-searching-2-columns-on-the-same-table-for-the-same-search-terms/#findComment-146995 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.