Daniel Brown wrote:
On Feb 16, 2008 6:22 PM, Rob Gould <[EMAIL PROTECTED]> wrote:
I've got a PHP script that inserts "00012345678" into a record in a mySQL database (it's 
a barcode).  Things work ok unless the number has preceding zeros, and then the zeros get cut off 
and all I get is "12345678".

I have the mySQL database fieldtype set to bigint(14).  If the maximum length a 
barcode can be is 14, is there a better fieldtype to use that will keep the 
zeros?

(or some way for PHP to tell mySQL not to chop off the zeros?)

    Rob,

    A few years ago, I developed a full-on inventory management system
(with barcode printing and assignment, as well as scanning) and found
that with Code 39 I didn't have the issue, but when using UPC or some
other format, I often had to convert the code to string().  Then
insert the data into a CHAR or VARCHAR column, because to most
systems, INT 001234 is equal to INT 1234, but with more overhead,
which is then normally trimmed.


zerofill is the way - the stupid but works way is to store the barcodes backwards :D or indeed base convert them from 10 to 32..

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

Reply via email to