Quote Originally Posted by TheRedDevil
Im just wondering why its too late to change the system now?

You only got approx 50k users, which is not much at all.
well, the thing is that I've just placed a part of the application against you guys, you don't know the whole workings of it & it'll be too much for me to explain it all, its inter-connected & all hell will break loose if I change the structure, that is if I manage to change it!!
You guys might think me of as some one silly & I don't mind that a bit, but the truth is that I'm not the project lead here, so I can only give my suggestions, I don't have the authority to have them implemented!! So that's why, I know I'll not be able to pull this 'change the structure' off!! So please accept & cease to suggest that.

Quote Originally Posted by TheRedDevil
Basically depending on the solution you chose (and you do have alot of solutions for this specifical problem) you can load the current IDs into a new table which only link the ID to its user, then delete the field from the database. Use either the real id field or create a new one.
Then update the script so it first check for the new id type, if it dont find any match there it check the new "linking" table if it matches the old id type.
Quite good alternative, but then, I've said before, no changes in the DB structure, I'm not the only one working on this stuff!!

Quote Originally Posted by TheRedDevil
No offence is meant but for me it seems like your dropping all the "easiest" and most "effective" solutions due to you think/feel they wont work due to ... ... ... instead of seeing the most obvious solution to fix the problem/mess (whatever you want to call it).
Quite true & I hate to admit it but I don't have a choice in there but to drop the "easiest" & most "effective" solutions!!

Quote Originally Posted by TheRedDevil
Actually if you sit down and consider this solution for 2 minutes Im sure you will notice how stupid you sound in that answer...
"stupid"?? I'll admit to be a third-rate idiot if admitting that can help things!!

Quote Originally Posted by TheRedDevil
On the other hand, as it has been mentioned I dont really think you got a problem at all, just improve your query and ID generator slightly and you will be good to go.

Just rewrite your generator and you are ready to go, in 98% of the cases the query will only be run once with twenty matches in it. And of course the function can be even more optimized and more ids can be added to the array. Btw please note that I have not tested the function below, so there might be a syntax error.

PHP Code:
function RandomID($id_array = array()) {
    
$id_temp '';
    
$id_real '(0 ';
 
    for(
$nr=1;$nr <= 20;++$nr
        {
$id_temp chr(rand(65,90)).chr(rand(65,90)).chr(rand(65,90)).chr(rand(65,90)).rand(0,9).rand(0,9).rand(0,9).rand(0,9);
 
        if (
in_array($id_temp ,$id_array)) --$nr;
        else 
$id_array[] = $id_temp;
        }
 
    foreach(
$id_array as $key => $value)
        {
        
$id_real .= ", '".$value."'";
        }
 
    
$id_real .= ')';
 
return array(
$id_real$id_array);
    } 
hmm, well, this certainly has given me an idea on improving the ID generation & minimising repeat IDs, not exactly as you suggest but something similar!! will need to check that out.

Quote Originally Posted by TheRedDevil
And just a side note, if your script manage to timeout on those few connections you might want to beat up whoever made the database and did the optimalizing or the guy who wrote the php script.
I'll add that to my ToDo list with a high priority, but then seeing what I've seen, I think that that person might not be the one to be blamed, not 100%, since he must've done what he was told to do, like I'm doing, not having much choice in there!!