cv-pls php question is unclear and a mess; it might be asking how to filter one query result set by another query result set but the requirements are poorly explained. One of the answers doesn't even try to filter data.
stackoverflow.com/q/28702405/2943403