I am trying to add a row in MYSQL table where I want it to contain letters and numbers with a limit of 4 characters (letters or numbers). In the same time.. if somebody wanted to submit something that have 3 characters or 2. I want the rest of the data to be filled with zeros
for example:
23e becomes 023e
2 become 0002
1234 stays the same
123e stays the same
I am trying to achieve the results in MYSQL database only without using PHP. Is it possible? If it is not possible what is the code to do that in PHP?
Use
charrather thanvarchar(this has a set amount of characters). In mysql:Also easy to do in PHP: