Hey there chunky,
If you create the user's table with the id to auto_increment, it will automatically assign the next available number, something like this:
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL auto_increment,
`username` varchar(30) NOT NULL,,
`email` varchar(50) NOT NULL,
`pass` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
KEY `email` (`email`)
) TYPE=MyISAM;
then you can echo ID on a page(instead of a username), and you can have them log in with the ID or the email, depending on your preference.
thanks,
json