AllExperts > PHP5 
Search      
PHP5
Volunteer
Answers to thousands of questions
 Home · More PHP5 Questions · Answer Library  · Encyclopedia ·
More PHP5 Answers
Question Library

Ask a question about PHP5
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Robert Davis
Expertise
My focus in PHP has been calculations, reporting, database manipulation (MySQL), automated scripting, screen scraping, and tracking systems. A more complete summary is posted at http://businesscatalyst.info.

Experience
I've been programming in many languages for over 13 years, but the last couple years I've focused on php. I've posted several tricks I've learned at goodfeelingplace.com.

Education/Credentials
I have a bachelors degree and a masters degree, both in electrical engineering from Arizona State University.

 
   

You are here:  Experts > Computing/Technology > Perl/PHP > PHP5 > create invoice number

PHP5 - create invoice number


Expert: Robert Davis - 10/16/2009

Question
Hi Robert,i'm creating the store from scratch with codeigniter..Are there any disadvantage with using autoincrement index?I've been thinking about creating a table that holds the number using varchar instead of int,i get the number from the table then i update it again if there are a transactions..But in another way,i've been thinking does it consume resources as i have to convert the string to int first and then convert it again.What is your suggestion?Thanks a lot and God bless you. ^_^

Answer
Hi Handoyo,
If you are doing it from scratch I would definitely recommend an autoincremented ID as the invoice number, as you know it will be unique and it is light on resources.  The only reasons I would do it another way is if you wanted to make the invoice number mean something, by including other info in it like customer ID/code, date, etc. - or if you needed it to be random or encoded for some reason.
Regards,
Robert

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.