ShaolinF Posted October 17, 2007 Share Posted October 17, 2007 Hi Guys, Does anyone know of any good ways of producing ramdon digits (4-8digit) for invoices ? Quote Link to comment https://forums.phpfreaks.com/topic/73664-creating-invoice-numbers/ Share on other sites More sharing options...
cmgmyr Posted October 17, 2007 Share Posted October 17, 2007 is there any reason why they need to be random? most businesses just have a running number (like auto_increment) Quote Link to comment https://forums.phpfreaks.com/topic/73664-creating-invoice-numbers/#findComment-371632 Share on other sites More sharing options...
ShaolinF Posted October 17, 2007 Author Share Posted October 17, 2007 That'll do too I guess. So how would I do it ? I'd like it in the 6 digit sphere. Quote Link to comment https://forums.phpfreaks.com/topic/73664-creating-invoice-numbers/#findComment-371634 Share on other sites More sharing options...
BlueSkyIS Posted October 17, 2007 Share Posted October 17, 2007 i typically use an auto-incrementing ID field and add whatever offset i need. for instance if i want invoice nums to start at 100001, i'll add 10000 to the auto-incrementing field. so i insert the invoice record, then get mysq_insert_id() and add the offset. assuming you're using mysql... Quote Link to comment https://forums.phpfreaks.com/topic/73664-creating-invoice-numbers/#findComment-371642 Share on other sites More sharing options...
cmgmyr Posted October 17, 2007 Share Posted October 17, 2007 or you could just start the auto_increment at 100000 Quote Link to comment https://forums.phpfreaks.com/topic/73664-creating-invoice-numbers/#findComment-371644 Share on other sites More sharing options...
ShaolinF Posted October 17, 2007 Author Share Posted October 17, 2007 Well I'm not using mysql as of yet. It's simply a small reg/paypal fee and the information gets emailed to me and the client gets a confirmation and a unique ID. Quote Link to comment https://forums.phpfreaks.com/topic/73664-creating-invoice-numbers/#findComment-371646 Share on other sites More sharing options...
cmgmyr Posted October 17, 2007 Share Posted October 17, 2007 It would be better if you used a MySQL database along with the emails. Quote Link to comment https://forums.phpfreaks.com/topic/73664-creating-invoice-numbers/#findComment-371653 Share on other sites More sharing options...
ShaolinF Posted October 17, 2007 Author Share Posted October 17, 2007 But wouldnt I use MYSQL if I wanted to later view the information on the website or something ? Quote Link to comment https://forums.phpfreaks.com/topic/73664-creating-invoice-numbers/#findComment-371664 Share on other sites More sharing options...
cmgmyr Posted October 17, 2007 Share Posted October 17, 2007 Yes, but it's also good to have that info backed up to reference it later. There is a million things that can happen to your email. Quote Link to comment https://forums.phpfreaks.com/topic/73664-creating-invoice-numbers/#findComment-371666 Share on other sites More sharing options...
ShaolinF Posted October 17, 2007 Author Share Posted October 17, 2007 Ok, thanks. I will start the mysql implementation hopefully. Quote Link to comment https://forums.phpfreaks.com/topic/73664-creating-invoice-numbers/#findComment-371678 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.