Jump to content

[SOLVED] 5-digit auto-increment ID


ryanwood4

Recommended Posts

you can't force it to have leading zeros in the DB...cus it's an integer and integers don't have leading zeros. but you can add the leading zeros when you display the number:

 

<?php
  $id = 5;
  print str_pad($id,5,'0',STR_PAD_LEFT);
  //or
  printf('%05d',$id);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.