Copy link to clipboard
Copied
Can anyone tell me how to make invoice number on a form to appear on the form using php. I cannot remember how to pull the number from MySQL primary id auto increment. I have a invoice form to take data and put into the database. I want to display the next available number from the database.
Thanks
Jon
Copy link to clipboard
Copied
>I have a invoice form to take data and put into the database.
>I want to display the next available number from the database.
So you want to display the next available number as the invoice number on the form? That's got potentially serious problems. What if two users access the form? User A will get the same 'next available number' as user B. You're better off providing the invoice number only after the update occurs.
Copy link to clipboard
Copied
How could I post the insert and then post back to another page all the info to print the invoice with number?
Copy link to clipboard
Copied
After inserting the row into the database, use the php function mysql_insert_id() to retrieve the invoice number to display for the user to print.
Copy link to clipboard
Copied
Here is a simple workaround: