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 Integrating PHP with Databases Limiting Records in SQL Setting LIMITs

catalog.php not loading in firefox, chrome or internet explorer.. Help.. Thank you in advance

Link to code: https://w.trhou.se/jmc8ebcmco

Receive this message everytime I try to see the catalog.php page in my browser The page isn’t redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. and Hmm, we can't reach this page. Try this Make sure you’ve got the right web address: http://port-80-anojdsm7c0.treehouse-app.com

I'm typing this http://port-80-anojdsm7c0.treehouse-app.com/catalog.php

LINK TO CODE: https://w.trhou.se/jmc8ebcmco (I do not know how to copy and paste code in this section, so I provide everyone with the treehouse link to my code)

Alena Holligan

Alena Holligan
Alena Holligan
Treehouse Teacher

Very close, mostly just matching spelling and one spacing issue. When building multi line db queries, make sure to add plenty of spaces between things. Extra space wont hurt, but not having space will.

functions.php: query was running together like "SELECT COUNT(media_id) FROM MediaWHERE LOWER(category) = ?"

//lines 9-12: changed $results to $result, added a space before WHERE
$result = $db->prepare(
        $sql
        . " WHERE LOWER(category) = ?"
      );

this was

catalog.php

//line 21 INIT changed to INT
$current_page = filter_input(INPUT_GET, "pg", FILTER_SANITIZE_NUMBER_INT);

//line 28: $total_page changed to $total_pages
$total_pages = ceil($total_items / $items_per_page);