I have a site where people can add members. THe login must be unique, naturally. And, since ai want the use to just sit back and let the machine do the work, I'm trying to figure out how to increment the login by 1 until it is unique. The logins are store in a mysql db. I tried the following while loop, but it went forever:
$SQL="select count(*) as howmany from mytable where login='$login'";
$result=$db->Execute($SQL);
$howmany=$result->fields["howmany"];
$count=$howmany;
while($howmany>0){
$login.=$count;
$SQL="select count(*) as howmany from mytable where login='$login'";
$result=$db->Execute($SQL);
$howmany=$result->fields["howmany"];
$count++;
}
Since this is inside a function, I also tried using static and global (separately) vars to track the count number that would be appended to the login. I'd realy like the logins to increment like the following:
biggus
biggus1
biggus2
etc
Anyone have any tips? Maybe it's because today is Friday, but I just can't seem to figure this one out.
Thanks,
Biggus