We've changed the edit page to use PDA and our new article class next.
Let's change the delete article page.
The first thing we do in the delete script is to get the article based on the I.D. in the query string.
We're doing exactly the same thing in the edit script only now using the new database and Article crassus.
So let's copy this code.
And we place the equivalent code in the delete script.
Like that.
Then when the farm is submitted were calling this code to delete the rijkaard.
Let's add a method to the particle class to do this instead
called delete.
And this will be a public method so we can call it on an object instance.
We're doing something similar to the Update method.
So let's start by copying this code leaving out the validation code
and pasting it in our new method.
Then we'll change the esky well to delete the rijkaard instead.
And we only need to bind the D parameter so we can delete these others.
Like that.
As with the update method we need to pass in the database connection.
And finally let's add a comment block like that.
Then we can replace this code in the delete articles script.
With a call to the new method.
And we can remove this Else block too.
One more thing we need to do is change this line where we're accessing the idea of the article for the
cancell link as before instead of accessing this as an array element.
This is now an object property like that.
Let's give that a try.
If I click undelete we get the confirmation prompts.
First let's check the cancell link works and it does.
And if I do really want to delete this rijkaard The record is deleted and we redirected back to the
index page as before.