My last post was messy, i am trying now a sequence but still no luck and I am exausted by this. Thanks for ANY help you may provide.
//Create the record first
$sql=" INSERT INTO $table_name (id,caseidnumber,timeintherapy,citizenship,firstname,lastname,birthdate)
VALUES('', '', '$POST[timeintherapy]', '$POST[citizenship]', '$POST[firstname]', '$POSTlastname]', '$POST[birthdate]')";_
$result=@($sql,$connection)or_die("Couldn't execute query.");
//Then update the record just created
$sql="UPDATE$table_name_SET_caseidnumber=CONCAT('ES',timeintherapy,citizenship,'1',SUBSTRING(firstname,1,1),SUBSTRING(lastname,1,1),DATE_FORMAT(birthdate,'%d%y'),'.''ES')where_id=$id";_
$result=@($sql,$connection)_or_die("Couldn't execute query.");