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 Using Relational Tables Querying Multiple Tables with JOIN

Ian Rushton
Ian Rushton
15,789 Points

Workspaces not corresponding with video in Integrating 'PHP with Databases' Course - Querying Multiple Tables with JOIN

When I opened the new workspaces to work alongside Alena, the code in functions.php did not correspond with that being shown in the video. Here is what was showing for me:

<?php
function get_item_html($id,$item) {
    $output = "<li><a href='details.php?id="
        . $id . "'><img src='" 
        . $item["img"] . "' alt='" 
        . $item["title"] . "' />" 
        . "<p>View Details</p>"
        . "</a></li>";
    return $output;
}

function array_category($catalog,$category) {
    $output = array();

    foreach ($catalog as $id => $item) {
        if ($category == null OR strtolower($category) == strtolower($item["category"])) {
            $sort = $item["title"];
            $sort = ltrim($sort,"The ");
            $sort = ltrim($sort,"A ");
            $sort = ltrim($sort,"An ");
            $output[$id] = $sort;            
        }
    }

    asort($output);
    return array_keys($output);
}

Tagging Alena Holligan

Alena Holligan
Alena Holligan
Treehouse Teacher

The workspace should be fixed now. If you delete your workspace (https://teamtreehouse.com/workspaces) for the course and relaunch a new workspace it should be corrected now

Ian Rushton
Ian Rushton
15,789 Points

Thank you Alena and Jason!

7 Answers

Alena Holligan
STAFF
Alena Holligan
Treehouse Teacher

Not sure what the problem was, but I was able to get this fixed and creating new workspaces correctly now. Let me know if you continue to have issues. Just in case, you can also download the project files.

Hi Alena Holligan, It's still not working for me. Tried deleting and relaunching it, but it's still different. Don't even have the connection.php.

David Harston
David Harston
7,261 Points

I'm having the same issue as above. I deleted the old workspace, but when I launch workspaces again, it shows the same code in functions.php as at the top of this page.

23 days to get a reply for an issue with the system. Not nice.

Ian Rushton
Ian Rushton
15,789 Points

I imagine the issue didn't flag up straight away because it was resolved initially and I didn't actually follow this up. My apologies all!

Alena Holligan
STAFF
Alena Holligan
Treehouse Teacher

Sorry Filipe, I somehow missed the notification until I saw something from David. Please feel free to email me as well if you're having issues with the php content.

Ah, ok. I understand. I definitely will. =) Thank you, Alena.

David Harston
David Harston
7,261 Points

All working great now. Thank you!