Código PHP:
//creo la consulta
mysql_select_db($database_dcbd, $dcbd);
$query_usu_chat = "SELECT * FROM usuarios ORDER BY id_usu ASC";
$usu_chat = mysql_query($query_usu_chat, $dcbd) or die(mysql_error());
$row_usu_chat = mysql_fetch_assoc($usu_chat);
$totalRows_usu_chat = mysql_num_rows($usu_chat);
//creo la lista de usuarios
<?php
$nombre_chat = $row_usu_chat['nombre'] ;
?>
<?php do { ?>
<a href="javascript:void(0)" onclick="javascript:chatWith('<?php echo $nombre_chat;?>')"><?php echo $row_usu_chat['nombre'];?><br>
</a>
<?php } while ($row_usu_chat = mysql_fetch_assoc($usu_chat)); ?>