Не сделал много php / mysql, но похоже, что это должно быть легко исправить. Я, вероятно, просто напортачил. Извините за длинное объяснение хотел быть тщательным
У меня есть база данных mysql с результатами фитнес-тестирования, и на сайте есть страница, на которой отображаются результаты вошедшего в систему человека.
Существуют конкретные данные, называемые симметрией баланса, которые собирает наше оборудование, и в результате получается либо положительный, либо отрицательный процент. Если у человека симметрия -15% или меньше, ему нужна дополнительная работа на левой ноге, а если у него симметрия + 15% или меньше, ему нужно больше работать на правой ноге.
Это очень важный фактор, поэтому я пытаюсь дать им знать с «красным флагом» в верхней части страницы. Данные хранятся в базе данных как отрицательное число или положительное число.
Я хочу, чтобы код сделал это:
- if the data is >= 15 then it spits out that they need more work on their right leg
- if the data is <= -15 then it spits out that they need more work on their left leg
- if the data is anything else, so between -14 and 14, or if it is null (sometimes they may not have done the balance part of the fitness test due to injury) then nothing is displayed
Способ работы с кодом ниже:
- if >= 15 works perfectly tells them to work on their right leg
- if <= -15 works perfectly tells them to work on their left leg
- if between -14 and 14 works perfectly tells them nothing
- if null tells them to work on their left leg for some reason. how do I make it so that the null value is handled the same way as the values between -14 and 14
PHP
<?php
if ($row['field_symmetry_value'] >= 15){
echo " <div class='train_row1'>
<div class='train_row_inside'>
<div class='train_column1rf'><img src='http://racebattlerecover.com/images/redflag.png' /></div>
<div class='train_column3rf'><h3>IMPORTANT: Your balance symmetry between your left and right leg is off by more than 15%. You need to add extra balance exercises to your right leg.</h3></div>
</div>
</div>";
}
elseif ($row['field_symmetry_value'] <= -15){
echo " <div class='train_row1'>
<div class='train_row_inside'>
<div class='train_column1rf'><img src='http://racebattlerecover.com/images/redflag.png' /></div>
<div class='train_column3rf'><h3>IMPORTANT: Your balance symmetry between your left and right leg is off by more than 15%. You need to add extra balance exercises to your left leg.</h3></div>
</div>
</div>";
}
?>
Спасибо за любую помощь!