php-How to get date wise unique transaction number

0 votes

 was thinking of formatting it like this

TYYYYMMDDNNNN (2 character + 12 digits)

Where

T is a character (TR or SL) YYYY is the year (2018) MM is the month (03) DD is the day (30) N is a sequential number (0001, 0002, 0003, etc.)

I need auto increment N after getting the last data from the MySQL database.

Such as

20180330-0001, 20180330-0002, 20180330-0003.

20180331-0001, 20180331-0002.

20180401-0001, 20180401-0002, 20180401-0003 etc.

Can someone help me do this?

May 27, 2022 in PHP by Kichu
• 19,050 points
325 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

How to get the client IP address in PHP ?

Hello, Here is a code sample of a good ...READ MORE

answered Apr 8, 2020 in PHP by Niroj
• 82,880 points
6,514 views
0 votes
1 answer

How to get name of current directory using php?

Hello @kartik, To get only the name of ...READ MORE

answered Aug 27, 2020 in PHP by Niroj
• 82,880 points
4,174 views
0 votes
1 answer

How to get current PHP page name?

Hello @kartik, You can use basename() and $_SERVER['PHP_SELF'] to get current page ...READ MORE

answered Aug 28, 2020 in PHP by Niroj
• 82,880 points
2,635 views
0 votes
1 answer

How to get Root Directory Path of a PHP project?

Hello @kartik, Try $_SERVER['DOCUMENT_ROOT'] contains this path: D:/workspace In that case you ...READ MORE

answered Sep 1, 2020 in PHP by Niroj
• 82,880 points
22,246 views
0 votes
1 answer

How to get current URL path in PHP?

Hello @kartik, Use $_SERVER['REQUEST_URI'].  The URI which was given in ...READ MORE

answered Sep 1, 2020 in PHP by Niroj
• 82,880 points
3,715 views
0 votes
1 answer

How to get original URL referer with PHP?

Hello @kartik, Store it either in a cookie or ...READ MORE

answered Sep 1, 2020 in PHP by Niroj
• 82,880 points
16,983 views
0 votes
2 answers

Define a SQL query? What is the difference between SELECT and UPDATE Query? How do you use SQL in SAS?

HI.. SQL is Structured Query Language, which is ...READ MORE

answered Aug 8, 2020 in PHP by anonymous
9,633 views
0 votes
1 answer

Why is not preferable to use mysql_* functions in PHP?

The reasons are as follows: The MySQL extension: Does ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,240 points
943 views
0 votes
2 answers
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP