0
My problem is this. I have two tables in my database, patients and diseases.
Table patients have the columns nomedopaciente, (symptom 1, symptom 2,....symptom n). Symptoms are fed with values between 0 and 1. As they are values of logic Fuzzy.
The Table of Diseases is a knowledge base, where the fields of disease have the name,(symptom 1, symptom 2,....symptom n). Symptoms are fed with values between 0 and 1. As they are values of logic Fuzzy.
It is necessary to scan these two tables, and generate a new one next.
Example: Relationship between table patients(nomedopaciente, symptom 1) x table diseases (diseaseName, symptom1). From this relation it is necessary to take the lowest value. That is. If (nomedopaciente, symptom 1) = 1 and (diseaseName, symptom1) = 0.45. The value returned from the check will be 0.45.
With the code below I can do this, the more I need to apply recursiveness, and not use for,s outside a recursive function.
//Pega repete a analise somente para o paciente corrente, ou seja 1.
for ($p=0; $p < 1; $p++) {
//Inicializa o arrey.
$_max = array();
//Pega todas as doenças registradas no banco para análise.
for ($d = 0; $d < count($doencas); $d++) {
//Inicializa o arrey.
$_min = array();
//Pega todos os sitomas registrados no banco para análise.
for ($i=1; $i < count($sintomas)+1; $i++) {
//Cria um array com as relações (sintomas x doença) e (sintomas x paciente), e gera o valor mínimo de cada uma.
array_push($_min, min($doencas[$d]['ap'.$i],$pacientes[$p]['ap'.$i]));
}
//Recebe o valor mínimo da relação, para cada doença.
$valor = max($_min);
//Gera um array com o valor máximo, da relação dos mínimos.
array_push($_max, $valor.' - '.$doencas[$d]['profissao']);
};
};
It has to be in PHP ? It can’t be select or a view already bringing in the format you need ?
– rbz
If the problem is the is can’t be foreach ?
– AnthraxisBR