Hello everyone, you must write to the array of the obtained value from the database, if it satisfies the condition. Here is the code, but does not give the value. Thanks for the help, please do not throw stones.
$ID=1; $ans1 = Array(); for ($i=1; $i<21; $i++){ if ($norm_getting[$i] ==1){ $query = "SELECT * from sfer_name LEFT JOIN calc on sfer_name.id_sfer = calc.id_sfer where calc.ID = $ID and calc.id_sfer = $i and calc.norm_getting = $norm_getting[$i]"; // получаем значения из таблицы с полученными ответами $sql = mysql_query($query,$link)or die(mysql_error()); $row = mysql_fetch_array($sql); $ans1[]=$row['sfer_name']; } }