anyone can help me how to make coding like below.

IF husband(L3) does not have a son (L1)
AND do not have a daughter (P1)
AND do not have the grandson of the son (L4)
AND do not have a granddaughter from son (P4)
THEN breakdown for men is 1 / 2

Recommended Answers

Ok so however you set your variables up, say using an array.

$husband['son'] = 0; //0=no 1=yes
$husband['daughter'] = 0;
$husband['grandson'] = 0;
$husband['granddaughter'] = 0;

// the php statement below would achieve what you are looking for I believe

if (($husband['son'] == 0) && ($husband['daughter'] == …
Jump to Post

Have you looked at the MySQL online manual?

pHp would probably be quicker for conditional processing. You just enter the result in your SQL.

Jump to Post

All 8 Replies

Ok so however you set your variables up, say using an array.

$husband['son'] = 0; //0=no 1=yes
$husband['daughter'] = 0;
$husband['grandson'] = 0;
$husband['granddaughter'] = 0;

// the php statement below would achieve what you are looking for I believe

if (($husband['son'] == 0) && ($husband['daughter'] == 0) && ($husband['grandson'] == 0) && ($husband['granddaughter'] == 0)) {
$men== '1/2';
} else {
//has son, daughter, grandson, or granddaughter
}

You could also use case function from php or set it up using normal variables but thats the jest of it.

Just use if statement and && or you can use || (meaning 'or') delimiters for your statement.

if (this==this) && (that==that) {
//then do this
} else if (these==these) {
//do these
} else {
// do it here
}

thanks a lot

How to get sql statement from a database like the problem

Husband IF (L3) does not have a son (L1)
AND do not have a daughter (P1)
AND do not have the grandson of the son (L4)
AND do not have a granddaughter from son (P4)
THEN breakdown for men is 1 / 2

Daughter IF 1 (P1) no son (L1)
THEN for a fraction of its women is 1 / 2

Mother IF (P2) there is no son (L1)
AND there are no girls (P1)
AND there are no male descendants of the sons (L4)
AND no granddaughter of a son (P4)
AND no 2/lebih whether male or female siblings / half brother / sister mother or a mixture of all three types of relatives are
THEN breakdown for Mom is 1 / 3

do u have any idea?.

Member Avatar

Have you looked at the MySQL online manual?

pHp would probably be quicker for conditional processing. You just enter the result in your SQL.

not yet....

Member Avatar

> not yet....

I don't wish to sound rude, but don't you think you should research your issue before asking contributors on a forum to do your work for you? Please read the forum guidelines.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.