hem100 Posted February 19, 2008 Share Posted February 19, 2008 Hi ppl.. I'm doing my project in PHP an Mysql.. I have a Problem... My Project is basically a complaint launching system.. Wat i need to do is generate a compalint no in this format dd-mm-yyyy-01 which would increment as the complaints keep on coming... every day the date must change.... for eg todays date is 19-02-2008 so the complaint no should be 190208-01,190208-02.... and so on .. and for the next day the conmplaint no must be 200202-01.... what i wanted toh ask if it is possible to generate such type of number... and if yes.. plz tell me how.... Quote Link to comment Share on other sites More sharing options...
suttercain Posted February 19, 2008 Share Posted February 19, 2008 Yes you can do it manually before hitting the database. You need to format the date, write a function to check for today's date and id number, if today's date already exists check the id number and increment by one ... $i++ Quote Link to comment Share on other sites More sharing options...
suttercain Posted February 19, 2008 Share Posted February 19, 2008 Quick question... does it have to be in the database as 010108-01 or does it just need to be printed as such (to the browser, invoice or whatever)? Quote Link to comment Share on other sites More sharing options...
hem100 Posted February 19, 2008 Author Share Posted February 19, 2008 Quick question... does it have to be in the database as 010108-01 or does it just need to be printed as such (to the browser, invoice or whatever)? It has to be saved in da database... Quote Link to comment Share on other sites More sharing options...
suttercain Posted February 19, 2008 Share Posted February 19, 2008 Yeah, than you'll have to do it the way I wrote. If you have never done PHP/MySQL it's not extremely hard, but not easy either. Here is a way to at least format the date like you need it... <?php $today = date('dmy'); //set up todays date as 190208 ?> Quote Link to comment 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.