Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Build a Basic PHP Website (2018) Listing and Sorting Inventory Items Displaying Item Details

DISPLAY IN BROWSER WRONG

I HAD TAKE PHOTO ABOUT BROWSER PLEASE HELP ME CHECK

http://imgur.com/HlxN4Qk

'''Php

<div class="media-picture"> <span><img src="<?php echo $item["img"]; ?>" alt="<?php echo $item["title"]?>" /></span> </div> </div> </div>

<div class ="media-details">

   <table>
    <tr>
      <th>Category</th>
      <td><?php echo $item["category"]; ?></td>
    </tr>
    <tr>
      <th>Genre</th>
      <td><?php echo $item["genre"]; ?></td>
    </tr>
    <tr>
      <th>Format</th>
      <td><?php echo $item["format"]; ?></td>
    </tr>
    <tr>
      <th>Year</th>
      <td><?php echo $item["year"]; ?></td>
    </tr>
    <?php if (strtolower($item["category"]) == "books"){

    ?>
    <tr>
      <th>Authors</th>
      <td><?php echo implode(" ,",$item["authors"]); ?></td>
    </tr>
    <tr>
      <th>Publisher</th>
      <td><?php echo $item["publisher"]; ?></td>
    </tr>
    <tr>
      <th>ISBN</th>
      <td><?php echo $item["isbn"]; ?></td>
    </tr>
      <?php } else if (strtolower($item["category"]) == "movies"){?>


    <tr>
      <th>Director</th>
      <td><?php echo $item["director"]; ?></td>
    </tr>
    <tr>
      <th>Writers</th>
      <td><?php echo $item["writers"]; ?></td>
    </tr>
    <tr>
      <th>Stars</th>
      <td><?php echo $item["stars"]; ?></td>
    </tr>
      <?php }

     else if (strtolower($item["category"]) == "music"){

    ?>
    <tr>
      <th>Aritst</th>
      <td><?php echo $item["arist"]; ?></td>
    </tr>
    <?php } ?>
  </table>


    </div>

'''

geoffrey
geoffrey
28,724 Points

It looks like an issue with your css, would it be possible to host this page ? With an image, It's not easy to help whereas If you give us a link, we'll be able to check your code.

3 Answers

Filipe Pacheco
seal-mask
.a{fill-rule:evenodd;}techdegree
Filipe Pacheco
Full Stack JavaScript Techdegree Student 21,415 Points

Hello Trần Phúc it looks like you placed the media details wrongly. I don't know if you posted the whole code, but try moving the two div closing tags that are before the <div class ="media-details"> to the end, right below </table>.

It would be something like this:

<div class="media-picture"> <span><img src="<?php echo $item["img"]; ?>" alt="<?php echo $item["title"]?>" /></span> 
</div> 

<div class ="media-details">

   <table>
    <tr>
      <th>Category</th>
      <td><?php echo $item["category"]; ?></td>
    </tr>
    <tr>
      <th>Genre</th>
      <td><?php echo $item["genre"]; ?></td>
    </tr>
    <tr>
      <th>Format</th>
      <td><?php echo $item["format"]; ?></td>
    </tr>
    <tr>
      <th>Year</th>
      <td><?php echo $item["year"]; ?></td>
    </tr>
    <?php if (strtolower($item["category"]) == "books"){

    ?>
    <tr>
      <th>Authors</th>
      <td><?php echo implode(" ,",$item["authors"]); ?></td>
    </tr>
    <tr>
      <th>Publisher</th>
      <td><?php echo $item["publisher"]; ?></td>
    </tr>
    <tr>
      <th>ISBN</th>
      <td><?php echo $item["isbn"]; ?></td>
    </tr>
      <?php } else if (strtolower($item["category"]) == "movies"){?>


    <tr>
      <th>Director</th>
      <td><?php echo $item["director"]; ?></td>
    </tr>
    <tr>
      <th>Writers</th>
      <td><?php echo $item["writers"]; ?></td>
    </tr>
    <tr>
      <th>Stars</th>
      <td><?php echo $item["stars"]; ?></td>
    </tr>
      <?php }

     else if (strtolower($item["category"]) == "music"){

    ?>
    <tr>
      <th>Aritst</th>
      <td><?php echo $item["arist"]; ?></td>
    </tr>
    <?php } ?>
  </table>

  </div>
  </div>
</div>

I hope it helps.

Have a look at the way your code is nested within the <div> tags. The answer lies within there.

Dennis Amiel Domingo
Dennis Amiel Domingo
13,403 Points

The "media-details" div block should be nested in the "wrapper" div block.