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

  • Home
  • SEARCH
  • 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 6222893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:23:41+00:00 2026-05-24T08:23:41+00:00

I am working on a custom content management system. I was instructed to do

  • 0

I am working on a custom content management system. I was instructed to do some changes, and this is what I need to do. I need to create a user management page which allows the administrator to delete (or disable his status) a user from the database.

This is my User Management Page:

<?php
$query = 'SELECT author_id, author_email as Email, author_name as Name
        FROM authors
        ORDER BY Name
        LIMIT 0, 30';

$result = mysql_query($query);

?>

<table class="listing">
<thead>
    <tr>
        <td>Author ID</td>
        <th>Author E-Mail</th>
        <th>Author Name</th>
        <th>Delete</th>
    </tr>
</thead>
<tbody>
    <?php
    for ($i = 0; $row = mysql_fetch_array($result); $i++) {
        if ($i % 2 == 0) {
            echo '<tr class="even">';
        } else {
            echo '<tr class="odd">';
        }
        echo "<td>{$row['author_id']}</td>";
        echo "<td>{$row['Email']}</td>";
        echo "<td>{$row['Name']}</td>";
        echo "<td><a href=\"del-user.php?term={$row['author_id']}\" onclick=\"javascript:return confirm('Are you sure you want to delete this user?')\">X</a></td>";
        echo '</tr>';
    }
    ?>
</tbody>
</table>

This is my del-user.php page:

<?php
include('inc/config.php');
$title = 'Delete Individual User';
include('inc/db.php');
include('inc/header.php');

echo '<h2>Delete</h2>';

if (isset($GET['term'])) {
$query = "DELETE FROM authors WHERE author_id = {$GET['term']} LIMIT 1";
mysql_query($query) or die('Failed to delete user');
echo '<p>User Deleted</p>';
echo '<p>Back to <a href="manage-users.php">Manage Users </>.</p>';
} else {
echo '<p>Tried to Delete: "';
echo ($GET['term']);
echo '"</p>';
echo '<p>Nothing to Delete</p>';    
}

include('inc/footer.php');
?>

I am new to PHP, but this is not working, the author_id value is not being passed to the other page, and it is being left empty. So I cannot delete anything from the del-users.php page.

I’m guessing that this is the problematic part:

echo "<td><a href=\"del-user.php?term={$row['author_id']}\" onclick=\"javascript:return confirm('Are you sure you want to delete this user?')\">X</a></td>";

Anybody knows why this is happening?

  • 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-05-24T08:23:44+00:00Added an answer on May 24, 2026 at 8:23 am

    Several issues:

    You send data like this:

    del-user.php?term={$row['author_id']}
    

    So that means that actualy $_GET[‘term’] contains the id.

    You catch the value like this:

    if (isset($_GET['author_id'])) {
    $query = "DELETE FROM authors WHERE author_id = {$_GET['author_id']} LIMIT 1";
    

    And it is not good, since $_GET[‘term’] contains the id, so you have to fix the lower one to look like this:

    if (isset($_GET['term'])) 
    $query = "DELETE FROM authors WHERE author_id = {mysql_real_escape_string($_GET['term'])} LIMIT 1";
    

    Also you need to expand the select query, since you are not actualy fetching the author_id from the db:

    $query = 'SELECT author_email as Email, author_name as Name, author_id
            FROM authors
            ORDER BY Name
            LIMIT 0, 30';
    

    Please, escape your variables before you trow them to the database…

    http://php.net/manual/en/function.mysql-real-escape-string.php

    Cheers

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

Sidebar

Related Questions

I am working on a Windows utility program which communicates with some custom hardware
I'm trying to get some custom views for a content query rollup working in
In some instances, I prefer working with custom objects instead of strongly typed datasets
I can't seem to get a custom action working. I might be doing this
I'm working on an RSS feed for a custom tasking system we use, and
I'm working on the development of a C++ API which uses custom-designed plugins to
I am working on a workflow in VS which creates a task with content
I'm working with a custom checkbox, and I'm trying to set the content to
I am working on custom search for my website. So kindly guide me which
I am working on an Android app which displays content in a WebView. The

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.