NameSilo

[PHP]Users list

SpaceshipSpaceship
SpaceshipSpaceship
Spacemail by SpaceshipSpacemail by Spaceship
Watch

cipcip

Top Member
Impact
1,611
A really simple php users list.

The code:

PHP:
<?php
$sql = "SELECT * FROM users ORDER BY user";
$res = mysql_query($sql);

if (mysql_num_rows($res)){
while ($list = mysql_fetch_array($res)) {

$letter = strtoupper(substr($list['user'],0,1));

if ($letter != $prev_row) {
echo "<br /><b><u>$letter</u></b><br />";
} 

echo "<a href='#'>{$list['user']}</a> <br />";

$prev_row = $letter;
}
?>

Will output this:

1zodlwz.jpg


Enjoy!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Instead of

PHP:
$letter = strtoupper(substr($list['user'],0,1));

You could also
PHP:
$letter = strtoupper($list['user']{0});
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Truehost — .com domains from $4.99, hosting includedTruehost — .com domains from $4.99, hosting included

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back