I want to display only certain data from database on my page, so I end my foreach
loop with if
and break;
statement. I checked with var_dump()
and the data is being provided from database correctly, function getName()
is also correct.
Moreover I inserted there a test "echo"test";
which is displaying well. But getName()
is still missing.
I think that problem might be with this if
statement, because when I delete it everything works correctly (except that I get data I dont want to get).
Same situation is when I insert if
statement after the getName()
function - this part of the code is not executed, it seems.
<?php //var_dump($leagues); ?>
<?php foreach($leagues as $leauge): ?>
<?php if($leauge->getLevel() != 'A') { break; } ?>
<li>
<i class="fas fa-long-arrow-alt-right"></i>
<?php $leauge->getName(); echo "test"; ?>
</li>
<?php endforeach; ?>