[Solved] Unique ID for year


The only way to be sure you have a unique Id in your data set is to test for it.

$id = uniqid(2012); //returns a 13 character string plus it will append 2012 for 17 characters.
$resultSet = //get dataSet from somewhere

foreach($resultSet as $row) {
    if ($row['id'] = $id) {
    //do some stuff
   }
}

This is a simple example of how you might flow this in a simple application. I’m sure there is probably a way to do this SQL as well (but I don’t know SQL that well).

Alternatively you could just let the database start at 1 and assign each record a unique value for it’s ID.

You failed to mention your purpose so these suggestions are a best guess.

Good Luck.

solved Unique ID for year