0

I have built myself a chat system but now I have a slight issue. I want the username for the logged in user to always sit at the top of the users list and the others to sit below.

This is how I want it :

enter image description here

But other accounts are appearing like this :

enter image description here

I want it like the first image for all accounts, but I still want the class order intact. Is that possible?

$active = mysql_query("SELECT id, username, class, warned, enabled, added
                        FROM users
                        WHERE last_access >= $dt
                        ORDER BY class DESC") or sqlerr(__FILE__, __LINE__);
Jeff
  • 12,555
  • 5
  • 33
  • 60
Muttley
  • 1
  • 3
  • Possible duplicate of [Making changes to multiple records based on change of single record with SQL](http://stackoverflow.com/questions/40623132/making-changes-to-multiple-records-based-on-change-of-single-record-with-sql) – e4c5 Dec 17 '16 at 12:47
  • 2
    If you're writing new code, **_please_ don't use the `mysql_*` functions**. They are old and broken, were deprecated in PHP 5.5 (which is so old it no longer even receives security updates), and completely removed in PHP 7. Use [`PDO`](https://secure.php.net/manual/en/book.pdo.php) or [`mysqli_*`](https://secure.php.net/manual/en/book.mysqli.php) with _prepared statements_ and _parameter binding_ instead. See http://stackoverflow.com/q/12859942/354577 for details. – ChrisGPT was on strike Dec 19 '16 at 19:48

0 Answers0