944,127 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Marked Solved
  • Views: 625
  • MySQL RSS
Oct 6th, 2009
0

how to record 3-digit zeros

Expand Post »
Okay idk if it's possible but I want one of my fields to have 000 as a default value and to maintain this value whenever called for. Like if I use PHP to run a query that asks for that field I want it to return "000". I'm doing this coz I'm playing with version records here.

OK so there's this thing called Zerofill, but I want it a little different. I want this field to be able to store INTEGER(5), but default value "000", a three-digit zeros. So if user do not enter any number, it will be "000", but user MAY enter up to 5 digits....
Last edited by AdventDeo; Oct 6th, 2009 at 4:44 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
AdventDeo is offline Offline
38 posts
since Aug 2009
Oct 6th, 2009
0
Re: how to record 3-digit zeros
hey its impossible to have any integer number '0' stored as '000' because it wil violate its defenition.
The easy way to have the db it that way, store '0' and display it '000' when it comes to scripting.
hope this might help you.
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Oct 6th, 2009
0
Re: how to record 3-digit zeros
Hmmm.... I guess that can work huh... thanks dude! =)
case closed!
Reputation Points: 10
Solved Threads: 0
Light Poster
AdventDeo is offline Offline
38 posts
since Aug 2009
Oct 6th, 2009
0
Re: how to record 3-digit zeros
that's great
have happy time and please mark the thread as solved.
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: retrieve the last record???
Next Thread in MySQL Forum Timeline: How to create multiple tables





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC