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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:04:32+00:00 2026-05-27T03:04:32+00:00

If I have a table like this: int VARCHAR int ———————————- 1 U 1

  • 0

If I have a table like this:

int        VARCHAR        int
----------------------------------      
 1          "U"            1
 2          "A"            1
 3          "B"            1

and I run a query through php’s mysqli like this:

$sql = "SELECT * FROM " . parent::GetTableName();
if ($current_user_only == TRUE)
    $sql = $sql . " WHERE userID_FK=" . parent::GetUserID();

$result = $this->get_db_con()->query($sql);
if ($result == FALSE)
    throw new Exception("SQL exec failed (". __FILE__ . __LINE__ . "):      $this->get_db_con()->error");

while ($row = mysqli_fetch_array($result))
{
    echo($row[1]);
}

I get an output like this:

 2          "A"            1
 3          "B"            1
 1          "U"            1

That is the result seems to be sorted by the VARCHAR column. If I run the same query in SEQUEL PRO it gives me results in the order I’m expecting which is the order in which they are entered in the table.

Any ideas?

  • 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-27T03:04:33+00:00Added an answer on May 27, 2026 at 3:04 am

    Short answer: there is none.

    Long answer:
    For MyISAM tables it’s the natural order, i.e. the order in which rows are stored on disk, which is usually the order of insertion. This can be modified by running ALTER TABLE ORDER BY
    For InnoDB tables it’s the order of primary key.

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

Sidebar

Related Questions

I have a SQL table, which looks like this: id_question (int) | tags (varchar)
I have a table OrganisationStructure like this: OrganisationID INT ParentOrganisationID INT OrganisationName VARCHAR(64) 1
I have a testdata like this: DROP TABLE SELECT_PASS; CREATE TABLE SELECT_PASS(ID INT(20),TESTCASE VARCHAR(20),RESULT
I have a table like this: create table t1 { person_id int, item_name varchar(30),
I have a SQL lookup table like this: CREATE TABLE Product(Id INT IDENTITY PRIMARY
If i have a table that looks like this: ID int Name varchar City1
I have two tables which looks something like this Table Queue int ID; string
I have something like this: create table account ( id int identity(1,1) primary key,
I have a table named categories like this: id int(11) NO PRI NULL auto_increment
If I have a table like this... create table #words ( id int identity,

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.