I’m using a simple form to insert posts to my MySQL database, I want each post to have an unique ID but don’t know the proper way to do it.
I already created a column named “PID” and set it as a primary key however I don’t know how to make each INSERT generate the PID. The only way I can think of is to make PHP look for the higher PID and add +1 to it. Is there an easier way to do it? Thanks
If you manage your MySQL database with a software like e.g. phpMyAdmin then you can set the “auto_increment” flag on this column.
Else you have to set it manually as described in this manual.