HalRau Posted November 28, 2014 Share Posted November 28, 2014 Members can be in up to three different categories, primary, secondary and tertiary. What I would like to do is have all members show in the result of a query string that looks for all members in a specific category no matter if it is their primary, secondary and tertiary category. Example: If say a visitor is looking for all members whose business category = 5 it will find and list all members whose BizCat1, BizCat2 OR BizCat3 equals 5 Right now I have this query string that finds all members in the members table with a BizCat1 = to %s. %s is a URLpararmeter variable passed over to the page. $query_RSwbamembers = sprintf("SELECT * FROM members WHERE BizCat1 = %s AND LiveOnWeb = 1 ORDER BY BusinessName ASC", GetSQLValueString($colname_RSwbamembers, "int")); I would like the query result to also includes members whose BiZCat2 = %s or BiZCat3 = %s (the same value as BizCat1) which are additional fields in the table. Any suggestion on how to do this appreciated. Link to comment https://forums.phpfreaks.com/topic/292776-combine-results-from-multiple-members-who-have-like-categories-using-or/ Share on other sites More sharing options...
Barand Posted November 28, 2014 Share Posted November 28, 2014 Use ... WHERE %d IN (BizCat1, BixCat2, BizCat3) AND LiveOnWeb = 1 ... Link to comment https://forums.phpfreaks.com/topic/292776-combine-results-from-multiple-members-who-have-like-categories-using-or/#findComment-1497951 Share on other sites More sharing options...
HalRau Posted November 28, 2014 Author Share Posted November 28, 2014 Awesome! Works perfectly. Thanks for your help Barand. Link to comment https://forums.phpfreaks.com/topic/292776-combine-results-from-multiple-members-who-have-like-categories-using-or/#findComment-1497962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.