Have a main “personaldata” table and a linked “medicalinfo” table.
Table structures are
personaldata: id, forename, surname, birthdate, gender, address… etc.
medicalinfo: id medinfo
Everyone has a personaldata record, but only a record in the medicalinfo if they have relevent data.
Everyone has the ability to update their own basic data using a HTML/PHP MySQLi form. Updating personaldata table is no problem, but am struggling with best way to update medicalinfo table.
What I have envisaged is checking to see if there is existing record, and if so delete it, then, if there is medical data entered create a new resord.
However it has been suggested that the code should check to see if there is an existing record then if no medical data in the form delete it, otherwise update it.
Which would be the most efficient way or is there a better way?