RE: [PHP] 4 Digit ID with Leading Zeros

From: Date: Thu, 15 Dec 2005 15:10:27 +0000
Subject: RE: [PHP] 4 Digit ID with Leading Zeros
Groups: php.general 
Request: Send a blank email to php-general+get-227470@lists.php.net to get a copy of this message
> > I¹m trying to figure out how to do this but am not sure. > Any help appreciated. > I'm not sure of what you are asking, but I'll assume that because you posted the to the PHP list, that you are asking how to take a MySQL autoincrement number and add leading zeros to it. Try this: $row=mysql_fetch_array($result); $four_digit_id=str_pad($row['id'], 4, "0", STR_PAD_LEFT); JM

« previous php.general (#227470) next »