This tutorial will teach you how to do auto generate Invoice No using Php Mysql step by step i attached full source code below.i explained more clearly in the video tutorial attached below. [crayon-632f03ed0d00b659397258/] i have attached the video link below. which will do this tutorials step by step.
Read More
-
Home
- Public
- Questions
-
Tags
-
Users
-
Companies
Collectives
- Explore Collectives
Teams
Stack Overflow for Teams – Start collaborating and sharing organizational knowledge. Create a free Team Why Teams?
Teams
-
Create free Team
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Ask Question
Asked 4 years, 3 months ago
Modified 4 years, 3 months ago
Viewed 3k times
-3
I would like to generate an auto increment invoice number using prefix.
Digits: 11 Prefix: B
From: B0000000001 to B0000000020.
Is there a easy way to do this in PHP?
- php
- sql
- prefix
- invoice
asked Jun 13, 2018 at 16:07
Dany BulletDany Bullet
11 silver badge2 bronze badges
1
3
What have you tried? str_pad and concatenation should make this pretty simple in php.
– Devon
Jun 13, 2018 at 16:09
Add a comment |
1 Answer
Sorted by: Reset to default
0
This is how you can do in in php.
$index = 11;
$prefix = 'B';
echo sprintf["%s%011s", $prefix, $index];
answered Jun 13, 2018 at 16:16
Jason KJason K
1,3961 gold badge9 silver badges15 bronze badges
1
echo sprintf[]
is an "antipattern". There is absolutely no reason that anyone should ever writeecho sprintf[]
-- it should beprintf[]
withoutecho
every time.– mickmackusa
Apr 16 at 3:21
Add a comment |
Not the answer you're looking for? Browse other questions tagged
- php
- sql
- prefix
- invoice
or ask your own question.
- The Overflow Blog
Five nines uptime without developer burnout [Ep. 488]
We hate Scrum and Agile…when it’s done wrong [Ep. 489]
- Featured on Meta
Recent Color Contrast Changes and Accessibility Updates
Reviewer overboard! Or a request to improve the onboarding guidance for new...
Should I explain other people's code-only answers?
Linked
92
How to make MySQL table primary key auto increment with some prefix
Related
2773
How can I prevent SQL injection in PHP?
3123
Add a column with a default value to an existing table in SQL Server
2271
How to concatenate text from multiple rows into a single text string in SQL Server
1291
Enumerations on PHP
2936
Deleting an element from an array in PHP
1239
Secure hash and salt for PHP passwords
2712
How do I get a YouTube video thumbnail from the YouTube API?
4114
How do I UPDATE from a SELECT in SQL Server?
4961
Reference — What does this symbol mean in PHP?
Hot Network Questions
- Looking for a short story about the highest flight ever
- Why does space warfare not lead to total anhiliation of both sides?
- Saturnian Cloud Cities Pt. 3- Wind Turbine Problems
- Can professors arrange for an MSc scholarship if you contact them by e-mail and they are interested in working with you?
- How do you determine if there is a significant relationship between two variables with several factors affecting it, using R?
- Word for a part of a book containing introduction and background/state of the art
- How to address team member who excessively defers to me and is unwilling to give clear feedback
- Opening emacs without the scratch buffer when opening a file [Please tell me what is wrong with my init file snippet]?
- What famous meme am I referencing with a polynomial?
- Why does the expectation value in quantum mechanics correspond to the classically measured value?
- Interpreting TRS-80 model 1/2 tape cassette audio
- What's a word for fake politeness?
- The same material looks different
- Why is triangle used instead of Quad?
- Why does a MOSFET gate respond to voltage and not current?
- Does killing an application kill the SQL connection?
- Current-limited H-bridge
- Can a single tympanal ear detect the direction or distance from which a sound comes?
- Automated generation of homework questions for line problems
- What's wrong with my joke 这位外科医生不礼貌,他总是说脏话, and how can I salvage it?
- Can I get a late payment on my credit card if apr is 0% for the first 21 months?
- Adding spaces to an apex class definition
- Why is this seemingly slower C loop actually twice as fast as the other way?
- When is it really worth it to convert RGB to CMYK [If printers do it anyway!]
more hot questions
Your privacy
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.