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 Records

Over simplifying or Over complicating?

I am stuck trying to understand the task being asked of me. I have read, re-read, tried a few ideas to no avail. I am not sure exactly how to proceed given the information.

1) Should I be writing a handful of lines of code including a Select statement to get the needed information then updating with the information

or

2) Is there something simple here that I am missing?

Option 1 seems to be alot for this exercise, and I will give it a try but I have the habit of over complicating seemingly simple tasks from time to time. It seems like they just wanted to have me review bindValue syntax but after a simple run at that I did not succeed.

Thoughts?

index.php
<?php
function reassign_task($old, $new) {
    include 'connection.php';

    //add code here

}

1 Answer

The previous video at the very beginning shows the code you will need.

1) You need a SQL statement (You won't be selecting records. Use the provided database map to create an UPDATE statement. You only need to update one table)

2) You need to prepare the statement

3) and 4) You need to bind each parameter $new and $old

5) You need to execute the statement

You don't need the try catch so you will be adding 5 lines of code to complete the challenge.

Thank you for your response. I was over complicating for sure. It still took me a few goes at getting the values and the WHERE clause appropriate. Thanks again.