Re: Auto Incrementing in PHP
| From: | Jason Wong | Date: | Sun, 19 Jan 2003 18:35:11 +0000 |
| Subject: | Re: Auto Incrementing in PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-132185@lists.php.net to get a copy of this message | ||
On Sunday 19 January 2003 09:03, Justin French wrote:
> on 19/01/03 9:59 AM, John W. Holmes (holmes072000@charter.net) wrote:
> >> Is there a way for a php page to automatically increment a number and
> >> store
> >> it every time the page is loaded.
> >>
> >> I want to generate an invoice number that goes up 1 everytime the HTML
> >> form
> >> is sent to it.
> >
> > I assume you're talking about incrementing for everyone that accesses
> > your site. For that you need a database to keep track of the number for
> > all users.
>
> Or use a file-based counter. There are 1000's of counter scripts out there
> both file based and database based.
If the application is mission critical then a simple file based counter is
wholly inadequate.
There are issues of concurrent access -- two or more instances of the script
trying to read and write to the file at the same time. Using a DBMS means
this problem is handled automatically and reliably.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
SEMPER UBI SUB UBI!!!!
*/