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 CRUD Operations with PHP Updating and Deleting Records Updating Projects

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Problem with updating projects (projects keep duplicating)

Okay. I've been stuck on this issue for a few days now and I've tried so many methods to solve it, including biting the bullet and attempting to get it working in Workspaces.

In the video, Alena solves a problem of project details not being updated but instead creating a duplicate of the project with the updated details.

I have followed through with the video but the projects still do not update correctly. You can therefore imagine the length of the list of projects on my local database. The problem still isn't solved and is the same bug that Alena demonstrated.

Here's a link to my workspace snapshot https://w.trhou.se/iou1zpn8nc

I've also updated my Github Repo.

Would Alena Holligan or somebody be able to take a look as I'm getting increasingly frustrated with this bug. :) Thanks

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

It's been less than a week and despite going back, to the start of section 4 and updating my repo I've still not found the answer.

If anyone happens to find this thread and has an answer, if they have time to look at the code in it and can post it to this thread! I'd be very grateful :)

1 Answer

R Brook
R Brook
17,937 Points

I had the same problem as you, but managed to get it working by making a small change in project.php in the code just above the submit button.

My new code:

<?php
    if (!empty($project_id)) {
        echo '<input type="hidden" name="id" value="' . $project_id . '" />';
    }
 ?>

The change that I made was adding = after 'value'. I didn't notice Alena doing this in the video, but adding it makes it work.