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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:26:41+00:00 2026-06-18T05:26:41+00:00

SQL: SELECT question,alt_1,alt_2,alt_3,alt_4 FROM questions WHERE id IN (’12’,’2′,’32’,’23’) PHP: while ($questions = mysql_fetch_array($game)){

  • 0

SQL:

SELECT question,alt_1,alt_2,alt_3,alt_4 FROM questions WHERE id IN ('12','2','32','23')

PHP:

while ($questions = mysql_fetch_array($game)){
    echo "$questions[question]";
}

I want the rows to be printed in the order the values are sent to sql: 12 – 2 – 32 – 23.

But fetch_array/sql(?) seems to sort the values so the order becomes the following: 2 – 12 – 23 – 32 (starts with the lowest number..)

Is there any way to stop the array from being sorted by numbers!?

  • 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-18T05:26:43+00:00Added an answer on June 18, 2026 at 5:26 am

    USE FIND_IN_SET

    SELECT question,alt_1,alt_2,alt_3,alt_4 
    FROM questions 
    WHERE id IN ('12','2','32','23') 
    ORDER BY FIND_IN_SET(id, '12,2,32,23')
    

    Note FIND_IN_SET(id, ‘12,2,32,23’) 12,2 without space

    FIND_IN_SET(field, 'val1,val2')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question: Given a SQL string like CREATE VIEW TestView AS SELECT value1, value2 FROM
I have the following SQL: SELECT ( (SELECT SUM(vote_score) FROM question_votes JOIN questions ON
I've got a question regarding a SQL-select-query: The table contains several columns, one of
Updated question: Django is giving me the following sql query: SELECT auth_user.id, auth_user.username, auth_user.first_name,
The answer to another SO question was to use this SQL query: SELECT o.Id,
Question: I can get the SQL Server database language by querying: SELECT @@language And
I have a small sql question for you. I have two queries: SELECT tbl_CostPrevisions.Month,
SQL : SELECT COUNT(usr.id) as `total_results` FROM users as usr LEFT JOIN profile as
SQL: select * from user where room_id not in (select id from rooms); what
SELECT Question.userid, user.uid FROM `question` WHERE NOT `userid`=2 LIMIT 0, 60 INNER JOIN `user`

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.