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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:04:58+00:00 2026-05-25T12:04:58+00:00

I have much count of items in MySQL database, and they must be shown

  • 0

I have much count of items in MySQL database, and they must be shown on a web page. But, element, which set up earlier, must be first of whole data array. Currently, data recevied from Mysql sorted by creation time. Also, every item has a unique ID, which store in settings table. May be you help me to solve this little trouble.

UPDATE:

this php-array basically demonstrate my db structure

    array(
       0=>array(
          "id"=>1,
           "name"=>"xyz"
       ),
       1=>array(
           id"=>3,
           "name"=>"abc"
       ),
       2=>array(
           id"=>5,
           "name"=>"asdfbc"
       )
    );

UPDATE 2

I need to sort previous array. For example, first element must be item with id = 3, after elements must be sort by time creation (desc or asc). Time field (timestamp) exist, but I’m too lazy for add it 🙂

  • 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-25T12:04:59+00:00Added an answer on May 25, 2026 at 12:04 pm

    Try this:

    SELECT *, IF(`id`=3,0,1) AS `sticky` FROM `test` ORDER BY `sticky` ASC, `timestamp` DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an outermost list which contains a monthly total count of different items
I have many items and many users in a database. A user can set
I don't have much experience working with resultsets, but as ResultSet is an interface,
I don't have much experience with Serial I/O, but have recently been tasked with
What does x :: xs' mean? I dont have much functional experience but IIRC
i need horizontal scrolling script in javascript, but don't have much time to write
This might be a simple one, but since I don't have much knowledge about
I have an array containing much more items than just this one. This is
At work, we purchased a package of sensors that count items as they pass
I'm pretty novice at MYSQL, but I'm attempting to get a count from a

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.