I've made sql statement to get brothers, uncles cousins and son of cousins if exist.
I typed this sql
$query = "SELECT secondname, thirdname, forthname, familyname, fullname, job, dob, address, internal_reference FROM public_elections WHERE";
$query .= " ( secondname = '$secondname' && thirdname = '$thirdname') || ( secondname = '$thirdname' && thirdname = '$forthname' )"; $query .= " || ( thirdname = '$thirdname' && familyname = '$familyname' ) || ( forthname = '$thirdname' ) ";
but still not working 100% correct and it gets persons not related.
how can i fix it.