I'm making a website using php and mysql and I want to create an auto increment ID for a table like this:
cl.001 , cl.002, dl.001 , dl.002 ... dl.010
The prefix is generated by a php function. I thought of this solution but I couldn't make it work:
$query='insert into table(reference) values (' . prefix() . ');'
I made an auto increment id (int), then a trigger :
TRIGGER `referenceTrig` AFTER INSERT ON `individu`
FOR EACH ROW UPDATE individu SET REFERENCE = CONCAT(REFERENCE,NEW.id) where id=NEW.id
But this also didn't work, I also thought of and 'instead of' trigger but it doesn't exist in mysql.