Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8484447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:23:00+00:00 2026-06-10T20:23:00+00:00

I have an administration panel that has a page allowing the administrators to delete

  • 0

I have an administration panel that has a page allowing the administrators to delete rows from the database. Each row they can delete has an associated image stored in a directory on the server. The image path is stored in the database as well.

What I need is when a user deletes a row from the table, I would like it to delete the image as well.

Here is my PHP to delete the row from the table:

include('includes/temp.config.php'); 


    if (isset($_GET['id']) && is_numeric($_GET['id']))
    {
            // get the 'id' variable from the URL
            $id = $_GET['id'];

            // delete record from database
            if ($stmt = $link->prepare("DELETE FROM templates WHERE id = ? LIMIT 1"))
            {
                    $stmt->bind_param("i",$id);     
                    $stmt->execute();
                    $stmt->close();
            }
            else
            {
                    echo "ERROR: could not prepare SQL statement.";
            }
            $link->close();

            // redirect user after delete is successful
            header("Location: edit.php");
    }
    else
    // if the 'id' variable isn't set, redirect the user
    {
            header("Location: edit.php");
    }

But I don’t even know where to start to delete the associated image… Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:23:01+00:00Added an answer on June 10, 2026 at 8:23 pm

    How about the unlink function?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After upgrading to Django 1.2 I have strange urls in my administration panel. They
I have built a custom administration panel into a Rails application that allows content
I have developed a small administration page for game servers which you can add/remove/edit
I have been using the 'Web Site Administration Tool' that you can bring up
How do I prevent my device administration application from being installed? I have created
I have a grid panel that is not shown in IE8 but everything works
I have a new Joomla (2.5) site that has been developed on a different
I have been using the embedded server that visual studio has to test my
I have a table that displays data from a MySQL table. I have an
I have a layout with 4 separate chunks. They are: A nav panel with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.