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 8216993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:19:35+00:00 2026-06-07T12:19:35+00:00

I setup a little site for my roomate whose an artist, and I set

  • 0

I setup a little site for my roomate whose an artist, and I set it up where he could use an admin.php page to upload images to the site, and they are added to a MYSQL Database where the main site pulls them from and displays them.

He wants the option to remove images from the same page he adds images, so I wrote a little code to display them again and add a “remove” link to each one. I can’t figure out what a good way would be to actually code the rest of it where it actually removes the image when he clicks it.

Can anyone possibly shed some light, urls, etc. that may help to get this finished? Here is what the admin.php looks like thus far…

<html>
<head><title>SethClem.com Image Management</title></head>
<body>

<form enctype="multipart/form-data" action="upload.php" method="POST">
Image File: <input type="file" name="image" /><br />
Description: <input type="text" name ="description" ><br>

<input type="submit" value="upload" />
</form> 

<?php
    include("../database.php");

    // Connects to your Database 
    mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()) ; 
    mysql_select_db($dbname) or die(mysql_error()) ; 

    //Retrieves data from MySQL 
    $data = mysql_query("SELECT * FROM images") or die(mysql_error()); 
?>
    <div style="width:100%; height:105px; border:0 ; padding:5px;">
    <table><tr>
<?php
    //Puts it into an array 
    while($info = mysql_fetch_array( $data )) 
    {
        $image = "../images/".$info['image'];
?>
    <td>
        <img src="<?php echo $image ?>" style="width:191; height:124; border:0px ; float:left;" />
        <a href="_blank">remove</a>
    </td>
<?php
    }
?>
    </tr>
    </table>
    </div>
  • 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-07T12:19:37+00:00Added an answer on June 7, 2026 at 12:19 pm

    replace

    <a href="_blank">remove</a>
    

    with <a href="http://www.your_domain.com/your_file.php?action=delete&id=12345">remove</a>

    now, put this php code imediatly after the db connection:

    if( isset( $_GET['action'] ) && ( $_GET['action == 'delete' ) )
    {
    
    $id = $_GET['id'];
    
    mysql_query("delete from `images` where `id`='$id' limit 1;");
    
    unlink($path_to_image.'/'.$file_name);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this nice little MSBuild-based daily build setup that I use on my
I'm configuring the admin site for my new app, and I found a little
I'm a PHP developer with little knowledge of bash commands and general use of
Trying to figure out a way to use Javascript to set up a little
A little setup: Our shop has a mixture of different platforms. Almost all of
My setup is a little complicated so let me go over that first. We
I want to setup a serialized task queue using NSOperationQueue but I'm a little
This might be a little bit picky, but in the iPad SplitViewController setup, there
I have the following code setup: http://jsfiddle.net/bABHU/2/ Had to change it a little bit
I try for a little while set up django-mptt in my project. I took

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.