Dear all,
I’m tryng to use this code to test age and sex of the user . Then with a series of if and elseif I calc some values.
At the level of first elseif I receive the error: Parse error: syntax error, unexpected T_STRING .
Is the sintax for using elseif correct ? I comment second part to understant where is the error.
if test { }
elseif test { }
elseif test { }
…
else { }
Anybody can help me ? Thanks . Giovannino
$sql =“SELECT SUM(quantity)as somma_qta FROM dayly_in WHERE dayly_in.id_dayly_in_m = {id_dayly_in_m} AND dayly_in.date_in = ‘{date_in}’”;
sc_lookup(dataset,$sql);
$somma_qta_r = {dataset[0][0]};
$sql_years = sc_exec_sql(“SELECT distinct years_old FROM users WHERE user_name = ‘[v_resource]’”);
$sql_sex = sc_exec_sql(“SELECT distinct sex FROM users WHERE user_name = ‘[v_resource]’”);
echo “Age”.$sql_years ;
echo “Sex”.$sql_sex ;
// Et? fino a 8 target 1400 M e F
if ($sql_years < =8)
{
$somma_qta1 = 1400 - $somma_qta_r ;
sc_master_value(‘day_lacking’, $somma_qta1);
sc_format_num({day_lacking}, ‘.’, ‘’, 0, ‘N’, ‘1’, ‘’);
}
elseif ($sql_years between 9 and 14) and ($sql_sex = 1)
{
$somma_qta1 = 2300 - $somma_qta_r ;
sc_master_value(‘day_lacking’, $somma_qta1);
sc_format_num({day_lacking}, ‘.’, ‘’, 0, ‘N’, ‘1’, ‘’);
}
/*
elseif ($sql_years between 9 and 14) and ($sql_sex = 2)
{
$somma_qta1 = 2100 - $somma_qta_r ;
sc_master_value(‘day_lacking’, $somma_qta1);
sc_format_num({day_lacking}, ‘.’, ‘’, 0, ‘N’, ‘1’, ‘’);
}
// Et? > 14 target 3200 M e 2500 F
}else if (sc_exec_sql(“SELECT distinct years_old FROM users WHERE user_name = ‘[v_resource]’”)> 14 and
sc_exec_sql(“SELECT distinct sex FROM users WHERE user_name = ‘[v_resource]’”) = 1)
{
$somma_qta1 = 3200 - $somma_qta_r ;
sc_master_value(‘day_lacking’, $somma_qta1);
sc_format_num({day_lacking}, ‘.’, ‘’, 0, ‘N’, ‘1’, ‘’);
}else (sc_exec_sql(“SELECT distinct years_old FROM users WHERE user_name = ‘[v_resource]’”)> 14 and
sc_exec_sql(“SELECT distinct sex FROM users WHERE user_name = ‘[v_resource]’”) = 2)
{
$somma_qta1 = 3200 - $somma_qta_r ;
sc_master_value(‘day_lacking’, $somma_qta1);
sc_format_num({day_lacking}, ‘.’, ‘’, 0, ‘N’, ‘1’, ‘’);
}
}
*/