This is the situation :the table order has a column with ID AUTO INCREMENT but (there is always a but)i can't use it because i don't want number order 1234567 after 5 years but i want 1/2014 , 1/2015 etc etc.For doing this i have created this columns into the table :ID AUTO INCREMENT <--- unique ID used for manage the order after the insert  numberorder INT <--- fake number of order showed at the user NOT unique  IDyear YEAR <--- the year for the order e.g. 2014 or 2015For doing this i write this code before the query for insert a new orderand processed at the submit form :$query_Recordset4 = SELECT MAX(IDyear) AS maxyear FROM order;$Recordset4 = $mysqli->query($query_Recordset4);$row_Recordset4 = $Recordset4->fetch_assoc();$maxyear = $row_Recordset4['maxyear'] ;$thisyear = date(Y) ;if ($maxyear === $thisyear) {    $query_Recordset5 = SELECT MAX(numberorder) FROM order WHERE IDyear=$thisyear ;;    $Recordset5 = $mysqli->query($query_Recordset5);    $row_Recordset5 = $Recordset5->fetch_assoc();    $numberorder = $row_Recordset5['MAX(numberorder)'] + 1 ;}else {      $numberorder = 1 ;}And then i use $numberorder for insert them into the table order in his column.QUESTION REVIEWMaybe my question was not clear written and now i try to add some elements.Thit is what i have now into the table order :|----------|-------------|--------||    ID    | numberorder | yearId ||----------|-------------|--------|!    1     |     1       |  2014  ||----------|-------------|--------||         |            |       |  <---- more orders|----------|-------------|--------||   500    |    500      |  2014  |  <---- last order year 2014|----------|-------------|--------|When the year change what i need is this :|----------|-------------|--------||   501    |     1       |  2015  |  <---- first order year 2015 (2016,2017 etc etc)|----------|-------------|--------|Like a suggestion, my code has a concurrency problem.Have a second table yearid with another AUTO_INCREMENT fieldfor take to them a unique ID for numberorder field is perfect solution but when the year finish i can't restarting the AUTO_INCREMENT at 1 because for security reason the TRUNCATE and DROP commands are not available for the user created for the connection.The only way i see is create a new table each year e.g. yearid2015 for have ID = 1.
Workaround for have 2 column with pseudo AUTO INCREMENT
php;mysqli