[PHP]Users list

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

cipcip

Top Member
Impact
1,675
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
Close
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
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Search: choose where to search from the All tab
Open the search at the top of any page. On the All tab, the list next to the search box lets you choose where to search: everything, all...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back