Jump to content

Display Mysql Info Alphabetically?


Drewdle

Recommended Posts

I have a 'user' table and a display users page.

 

How would I display them in alphabetical order by their username?

 

Heres my current basic display page:

<?php
include 'dbwire.php'; 
include 'header.php';
$query = mysql_query('SELECT * FROM user');

while ($row = mysql_fetch_array($query)) {  
       echo '<b>Username:</b> ' . $row['user'] . '<br />';
       echo '<b>Real Name:</b> ' . $row['name'] . '<br />';
       echo '<b>Email:</b> ' . $row['email'] . '<br />';
       echo '<b>Location:</b> ' . $row['location'] . '<br /> <hr>';
}
?>

 

Theres also an id row but since user wouldn't be added alphabetically I wouldn't be able to order them by id.

Link to comment
https://forums.phpfreaks.com/topic/224355-display-mysql-info-alphabetically/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.