Skip to content Skip to sidebar Skip to footer

Delete Row With Php - Pdo On Webpage

I am trying to delete a row from a table using PHP (PDO) on a page listing the rows entered into the database. I've been tinkering with the delete.php code to try to make it work b

Solution 1:

As your question stands, it seems you're accessing the wrong index.

In your link it is defined as id:

<ahref="delete.php?id=<?phpecho$event['event_id']; ?>">Delete</a>
                  // ^

But then accessed in your PHP file as:

$event_id=$_GET['event_id'];

Must be: $event_id = $_GET['id'];

Either you change your url as ?event_id in the anchor or change the array index in your PHP $event_id = $_GET['id'];. The important things is they must match.

Post a Comment for "Delete Row With Php - Pdo On Webpage"