Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Edit Procedure2:44 with Alena Holligan
We'll finalize our book modifications by creating the editBook procedure.
We need to set up the edit procedure.
Let's copy our addBook.
And create a new file named editBook.
First we need to add the bookId.
Then we change the addBook function to updateBook.
And we pass the bookId as well.
And finally we change add.php to edit.
And we need to pass the bookId.
Next we need to create the updateBook function in the functions file.
Let's close out some of these files.
And let's start by duplicating the addBook.
We'll change this to updateBook, and accept the bookId.
Now we need to change the SQL statement.
SET name=:name, description=:description.
Id = bookId.
We'll remove the ownerId from here.
And we'll change ownerId to bookId.
Let's check this out in the browser.
You need to sign up for Treehouse in order to download course files.Sign up