EbrahemSamer
2 months ago
111
1
General

How to get family members using person's name MYSQL ?

Posted 2 months ago by EbrahemSamer

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.

Please sign in or create an account to participate in this conversation.