RE: 4 Digit ID with Leading Zeros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux