P粉0837850142023-09-06 16:38:27
The problem is this code:
<td><a href="<?php $user->delete()>?">Delete</a></td>
The problem is that when you call that page, you delete the user directly instead of printing a link to the delete page.
You need to create a separate route (or a .php file if you are not using a framework), such as delete_user.php?user_id={your_user_id} or /{user_id}/delete (in a framework scenario)< /p>
This route/page must check the user passed in to the page for the presence of ads and then delete it by getting the user from the database and calling the delete()
method.
Afterwards, your code will look like the following in a php framework scenario:
<td><a href="http://www.example.com/<?php $user->id?>"/delete>Delete</a></td>
Or in a standalone scene like this:
<td><a href="http://www.example.com/delete_user.php?user_id=<?php $user->id?>">Delete</a></td>