I have a table with cases in which on HTML form POST I create an INT case_id autoincrement number. In this table I would like to have a filed nas_br witch will be a varchar column in whom I would like to combine the ID field from form input + case_id just created on insert.
Example: When I create a new case I pass the ID filed of let's say number 3, case_id is created on an insert with number 4. I need to pass that info automatically to field nas_br so it would be 34. (I will add a dot in between but that's easy I guess).
My question is is this even possible to do on the fly because case_id is made on the insert, or I need separate process. How can I do this automatically on form input?
EDIT: Generated Columns are not supported in MARIADB on primary key/autoincrement.
$sql = "INSERT INTO PREDMETIF (ID, NAZIV, PROTUSTRANKA, SUD, SUDBROJ, PREDMET, VPS, grad, post_br, adresa, jb, upr_tj, sudac, datum, status) VALUES ('$STRANKAFID','$STRANKAFNAZ','$PROTUSTRANKA', '$SUD', '$SUDBROJ', '$PREDMET', '$VPS', '$grad', '$post_br', '$adresa', '$jb', '$upr_tj', '$sudac', '$datum', '$status')";
$query = mysqli_query($conn, $sql);
EDIT As using Generated Columns is not supported on primary keys and AUTO_INCREMENT, found the other solution here: What is the alternative for generated column in MySQL 5.6. This creates a new table in Views and copy the table PREDMETIF with added column nas_br and does the adding. It's not in the original table but it gets to job done.
CREATE VIEW PREDMETIFView AS (
SELECT ID, case_id, COALESCE(CONCAT(ID, '.', case_id)) AS nas_br
FROM PREDMETIF
)