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

The Archive Base Latest Questions

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

The index is automatic, the indexes are 0, 1, 2, etc. nothing special. But

  • 0

The index is automatic, the indexes are 0, 1, 2, etc. nothing special.

But the key to the database is auto-incremented. meaning the index directly correlates to the key of the database. So after the sort, I can do a query and retrieve the info on that row with that key.

But I think that once you sort(), it changes the index, therefore I would lose that correlation between the index and the key of the database therefore making the array quite useless…so my question is how do I keep that correlation while still sorting so that the highest value goes to the top?

And then after that’s successful, how do I sort through an array like that?

Thanks so much for your help and patience,
Binny

  • 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-23T11:59:24+00:00Added an answer on May 23, 2026 at 11:59 am

    I think what you want is asort() or arsort(). According to the documentation for asort(),

    This function sorts an array such that
    array indices maintain their
    correlation with the array elements
    they are associated with. This is used
    mainly when sorting associative arrays
    where the actual element order is
    significant.

    arsort() sorts in the reverse direction.

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

Sidebar

Related Questions

Grails does automatic schema modifications (including index/foreign key updates) when changing the domain model.
Now I want to automatic redirect to facebook application's index page after user installing
I find this feature of automatic selection to item index 0 in the Listbox
index = 5; alert($('ul li:eq(index) a',context).html()); This script will alert : Null , but
Inverted index is designed to be fast for searching but not that easy for
On a symfony production server, an automatic update has uninstalled libapache2-mod-php5. So after that,
I am using acts_as_ferret(0.4.3) to do full-text searching, but when update index I need
I am using CoreData for my iPhone app, but CoreData doesn't provide an automatic
index.php: <form action=update_db.php method=post> <?php require_once 'modules/' . $currentModule . '.php'; ?> </form> modules/
index.php <?php require_once('fr.php'); header('Location:'.abspath().directory()); ?> fr.php <?php require_once('functions.php'); ?> functions.php function abspath() { return

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.