linta980
linta980

Reputation: 1

Barcode input into database fails in php

When i scan a barcode in "form" it automatically inserts it in database but two first digits are missing (two first zeros) . So , for example if a barcode 0020166196800002 is scanned and inserted into database only number 20166196800002 is inserted without first two digits of "00". Please, help!

Upvotes: 0

Views: 159

Answers (1)

Sven
Sven

Reputation: 70863

Databases do strip leading zeros if the column type is numeric and there is no zero padding configured.

For example, MySQL allows a column to be defined with "zerofill(x)", which results in every number being at least x digits long, and a stored zero will come up as x 0 characters instead of only one.

Upvotes: 2

Related Questions