Saturday, 24 August 2013

How to keep track of mysql database table entries by chronological insertion in php

How to keep track of mysql database table entries by chronological
insertion in php

I had originally wanted my alarmID value to be the primary key and to be
Auto incremented. But I have decided to make my Title value as so.
How can I manually auto increment alarmID so that every time I insert
values, the alarmID value gets incremented by exactly 1.
I want a way to keep track of entries by when they were inserted to be
display chronologically later on.
Here is how I have my php code.
$sql = "CREATE TABLE IF NOT EXISTS alarms (
alarmID INT NOT NULL,
PRIMARY KEY (Title),
Title CHAR(30) NOT NULL,
Description TEXT,
DT DATETIME
)";

No comments:

Post a Comment