php - Inserting Multiple Rows In SQL SERVER -
i making audit form takes account available fields.
i have columns, session_id (the id of current form created) ,fieldname, old value, new value. old value populated if user decides change value in form , saves it.
so ideally when user fills out form first time , saves it, should create new rows (3 rows in example there's 3 fields) given details.
|-----------------------------------------| | id | fieldname | old value | new value | |_________________________________________| | 123 | title | | mr | |_________________________________________| | 123 | firstname | | bob | |_________________________________________| | 123 | lastname | | smith | |-----------------------------------------|
that audit 1 form 3 fields. there way in 1 sql request? populate table fieldnames available in form.
an example of if update field.
|-----------------------------------------| | id | fieldname | old value | new value | |_________________________________________| | 123 | title | | mr | |_________________________________________| | 123 | firstname | bob | tim | |_________________________________________| | 123 | lastname | | smith | |-----------------------------------------|
Comments
Post a Comment