Welcome to the iTechForums.
If this is your first visit, be sure to check out the
FAQ by clicking the link above.
You may have to
register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
To register now click here.
|
Latest Threads
Advertisements
Forum Statistics
Threads:
Posts: 2
Members:
Number of Users Online:
Welcome to our newest member, |
|

05-15-2008, 03:50 PM
|
|
Junior Member
|
|
Join Date: May 2008
Posts: 1
|
|
How to set 1 to 001 (3 digits) in PHP & MySQL?
Let say productID is a primary key and running number when we enter new data. How to get 1 as three digits like 001?
|

05-15-2008, 08:53 PM
|
|
Junior Member
|
|
Join Date: May 2008
Posts: 2
|
|
function pretty_format($num)
{
if ( $num > 999 )
{
// .. report error
}
if ( $num < 10 )
{
return "00" + ((string)($num));
}
else if ( $num < 100 )
{
return "0" + ((string)($num));
}
else
{
return ((string)($num));
}
}
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
All times are GMT. The time now is 10:30 AM.