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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:26:34+00:00 2026-05-27T07:26:34+00:00

I am trying to sort my SQL database alphabetically by location. I executed the

  • 0

I am trying to sort my SQL database alphabetically by location. I executed the command: SELECT * FROM users ORDER BY location on the phpMyAdmin website, and the users are now indeed ordered alphabetically by location on the online database. However they still don’t display in alphabetical order on our website. Here is the code where I output the relevant SQL data:

<div>
  <table id="checkintable">
    <tr>
        <th>Name</th>
        <th>Location</th>
        <th>Comment</th>
    </tr>                  
  <? $result = mysql_query("SELECT fullname, location, comment FROM users"); ?>
  <? while ($row = mysql_fetch_array($result)): ?>
    <tr class="tables">
        <td><?= $row["fullname"]?></td>
        <td><?= $row["location"]?></td>
        <td><?= $row["comment"]?></td>
    </tr>
    <br>
  <? endwhile ?>
  </table>
</div>

Am I doing something wrong in this code? I want to display the table in the same order that the online database is ordered in, but it isn’t working.

  • 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-27T07:26:34+00:00Added an answer on May 27, 2026 at 7:26 am

    Change your:

    mysql_query("SELECT fullname, location, comment FROM users")
    

    to:

    mysql_query("SELECT fullname, location, comment FROM users ORDER BY location")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to move a SQL Server database from webfusion to heartinternet. It was
I'm trying to sort a resultset using the SQL statement Order by using JPA,
I am trying to transfer a website from A to B. Unfortunately, I am
I am trying to connect to a SQL Server 2008 database through a C#
I'm trying to create a SQL Server Compact 4.0 database in code, and I
I am trying to order a database by date but I am having trouble
I am trying to add user-defined aggregates to a SQL Server 2008 database whose
I have two tables from two different databases. For example: Table: Articles1 - Database:
I have a pathological issue with SQL, so I usually sort all of my
I am using SQL-Server 2005. I have a dev and prod database that have

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.