I was wondering if anyone could help me out with this problem. I have a script that has a bunch of code in it. For some reason the coder decided to use a hex for a id number (it's just a member number, nothing secret) anyway the code section that I want to change is this :
[code=php]
function createUniqueID( $table, $column)
{
$maxTries = 10;
while(1)
{
if($maxTries <= 0)
return false;
$uniqueID = substr(md5(uniq id(rand(), true)), 0, 8);
// check if this token does not exist in the table already
$sql = "select $column from $table where $column="._q($u niqueID);
$rs = (directory where code is located)::execu te($sql, __FILE__, __LINE__);
if(!$rs)
{
showMsg(L_G_DBE RROR, 'error');
return false;
}
if($rs->EOF)
return $uniqueID;
$maxTries--;
}
return false;
}
[/code]
I just want a 5 digit sequential number. Can someone tell me how to change this. I realize that auto_increment would work in the db, but, there is so much code that interrelates in the script I don't believe that removing this string would work properly. Thanks for any help.
[code=php]
function createUniqueID( $table, $column)
{
$maxTries = 10;
while(1)
{
if($maxTries <= 0)
return false;
$uniqueID = substr(md5(uniq id(rand(), true)), 0, 8);
// check if this token does not exist in the table already
$sql = "select $column from $table where $column="._q($u niqueID);
$rs = (directory where code is located)::execu te($sql, __FILE__, __LINE__);
if(!$rs)
{
showMsg(L_G_DBE RROR, 'error');
return false;
}
if($rs->EOF)
return $uniqueID;
$maxTries--;
}
return false;
}
[/code]
I just want a 5 digit sequential number. Can someone tell me how to change this. I realize that auto_increment would work in the db, but, there is so much code that interrelates in the script I don't believe that removing this string would work properly. Thanks for any help.
Comment