Discussion Locked

Creating a commercial website

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am on the process of creating my online web store.
The site is selling pin numbers. The pin numbers are stored in a text file, My problem is that after the customer complete the transaction, I want him to get in his receipt email the pin number, and at the same time, I want that pin number to be removed from my text file, so that the next customer will not get the same pin number as the previous one.
Any idea how can I do this?.

1 reply

by pthompson

Why use a text file - what I mean is this is a very simple proposition with a simple SQL bases database :-

CREATE TABLE PIN (
PINNUMBER int not null,
ALLOCATED char(1) not null)

select MAX(PIN) as MYMIN
from PINNUMBER
where ALLOCATED = 'N'

update PINNUMBER
set allocated = 'Y'
where PIN = :MYPIN

The user gets sent 'MYPIN' which is always the highest unallocated PIN number.

This discussion is closed to new replies.