Delete mySQL table from php link not working (Blank page appears)


I've listed a list of rows from my mySQL database onto an admin page. I now simply want to add an icon beside each row giving the user the option to delete the row in question.

Here's my php delete link:

<a href="delete.php?action=delete&id='$id'"><i class="icon-circle-blank"></i></a>

And my delete.php file looks like:


require_once 'db.php';
global $con;

    if(($_GET['action'] == 'delete') && isset($_GET['id'])) {

    $id = $_GET['id'];
    $sql = "DELETE FROM quotes WHERE id = '$id'";
    $query = mysqli_query($con, $sql);


header("location: http://localhost:81/logintest/home.php");



From some reason when I click the link, the page just returns a blank page with no database rows being deleted. What am I overlooking?




Unless you're showing us a pseudo-code, this will not parse the PHP id variable:


you need either:

delete.php?action=delete&id=<?= $id ?>


delete.php?action=delete&id=<?php echo $id; ?>

People are also looking for solutions to the problem: html - Table Province District and Subdistrict with PHP


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.