In my project i need to register a donor and I need the user to enter his information and the system registers him and generate a unique id to the donor.
Make a table with a field ID that has an index and has auto increment on.
CREATE TABLE Persons
(
ID int NOT NULL AUTO_INCREMENT,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255),
PRIMARY KEY (ID)
)
If you now add a new rule with MySQL you can leave the ID field empty, or just don't pass it like below
INSERT INTO Persons(LastName, FirstName, Address, City) VALUES('Your firstname','lastname','adress','city')