Sounds like it must be getting cast to a number somewhere along the track. 
You probably have been here, but make sure that:

1. You are not performing any mathamatical calculations or comparisons on 

2. When putting then in the DB make sure the string of numbers is quoted.

Try var_dump($string_of_numbers) to see if it has the leading 0's and what 
its type is immediately before you insert into the DB.


Owen Prime

Michael Conway wrote:

> I have a problem using barcodes.  They are variable in length (up to 13
> integers).  I had to add them to the tables a strings (varchar(13)) to
> preserve the leading zeros that are not uncommon.  The problem comes
> with inserting these barcodes into other tables (passing them using
> href).  When using a shopping cart application and inserting the barcode
> from the product table into the items table (to store the user's
> shopping cart contents), the leading zeros are lost.  Needless to say
> that using the original tables with the true barcodes to verify the
> contents of the user's cart for purchases and pricing subsequently
> fails.  Is there a way to ensure the string is preserved in its entirety
> when added to a new table using scripts?
> Michael Conway
> (703) 968-8875

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to