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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:28:40+00:00 2026-05-21T05:28:40+00:00

I have a simple admin I’m creating for a client using PHP and Mysql.

  • 0

I have a simple admin I’m creating for a client using PHP and Mysql. Anytime I wish to edit or delete a record I have to send the table name and unique index of my record(an auto incremented field I call index) in my query. This is fine except passing around a table parameter seems like it would be redundant if Msyql generates it’s own unique index for EACH record in a particular database.

Anyone know if there is such a thing?

THE REASONING:

I’m making an admin table with (for this example) two columns. One column has a title, the other has a delete button. To build this table I query a table called inventory:

$query = "SELECT * FROM `inventory`";
$results = mysql_query($query);
$table = 'inventory';
$returnString = '
    <table>
        <tr>
            <th>Title</th>
            <th>Command</th>
        </tr>
    ';

while($data = mysql_fetch_assoc($results)){
    $returnString .='
        <tr>
            <td>' . $data['title'] . '</td>
            <td><input type="button" value="delete" onclick="remove_record(' . $data['index']. ',\'' . $data['table'] . '\')" />
        </tr>';
}

$returnString .='</table>';

return $returnString;

So, it’s fine. It works fine except that I’d be happy NOT sending around two pieces of data (the index AND table name) through my javascript function, back through my formhandler back through my query to retrieve a piece of data I GENERATED FROM an original query.

It would be GREAT if there was some sort of GLOBAL reference to a record so I could create a function that would just eliminate a record from ANYWHERE in my database.

  • 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-21T05:28:41+00:00Added an answer on May 21, 2026 at 5:28 am

    To my knowledge, MySQL doesn’t create an expicit unique id (e.g. a global guid) for every record created in the database. I also don’t think it makes sense for it to exist, since this job is already fulfilled by creating primary keys in each table.

    The combination of the table name and that table’s primary key are the unique value for the record since no other record in the database can hold that primary key for that table.

    I’m at a loss to comprehend the reasoning behind this question. If you need to store a reference to a specific record in a separate table, then you should be adding a foreign key constraint on that other table to reference the primary key of the first table.

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

Sidebar

Related Questions

I have a simple page in a PHP/MySQL web application that lets admin users
I have a simple django app that is using only the admin. This is
I have this simple PHP function in admin.php function accountMenu() { if (isset($_SESSION['user_id'])) {
Ok, i have simple scenario: have two pages: login and welcome pages. im using
I have a simple admin database. I want to port it to search and
I have a simple application with a customer and appointment models, system admin can
I have a simple Rails 3 blog app that needs an admin user so
In my app I have a table for ROLES. Pretty simple: 1: Admin, DESC
I have simple regex \.*\ for me its says select everything between and ,
In general, is it a best practice to have simple POJO Java classes implement

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.