Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Yaron Attar
Yaron Attar
9,738 Points

Code Challenge: Accounting for Empty Results (2 of 3)

Hi, im stuck having problems with this challenge, i checked and rechecked still cant find what am i doing that i got this error - "Bummer! The array is empty, but I don't see the message indicating that no flavors are found." this is my code:

<?php

    $recommendations = array();

?><html>
<body>

    <h1>Flavor Recommendations</h1>

<?php  if (!empty($recommendations)){ ?>
    <ul>

     <?php foreach($recommendations as $flavor) { ?>
          <li><?php echo $flavor ?>; </li>
          <?php } ?>
    </ul> 

     <?php } else { ?>
         <p>'There are no flavor recommendations for you.'</p>; 
         <?php } ?>

?>
</body>
</html>

1 Answer

Yaron Attar
Yaron Attar
9,738 Points

problem solved! me stupid!