I have a table and one of the columns should have a button called delete. However I have tried different code-examples but the delete button still doesn't work.
This code here shows the delete button and it works really fine:
echo '<td><a class="btn btn-default" href="delete.php?courseId='.$row['courseId'].'">Delete</a></td>';
and the next code is my delete-code:
<?php include("dbconnect.php");  
$courseId =$_GET['courseId'];
$pdo = Database::connect();
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $sql = "DELETE FROM course WHERE courseId= $courseId";
        $q = $pdo->prepare($sql);
        $q->execute(array($courseId,$courseName,$desc));
        Database::disconnect();
        header("Location: courseList.php");     
?>
Thanks in advance~
 
     
    