What is the best way to code below instead of just repeating six times and replacing the word "profile" with
"hobbies", "personality", "photos", "video" & "match" each time?
I was thinking of a more general design pattern. With things like this, it makes sense to have an internal array of the options and a one-to-one mapping of the keys in the POST array with the column names in the data base table. The code in the code snippet only translates Y into 1, N into 0 and A into something absent. This is not a very powerful piece of programming. Why not just let the right information come in from the POST array so no translation is needed?
You might consider using an array of objects, where the array keys are "profile","hobbies","personalities","photos","videos","match" and the objects contain all the "active record" information about the user in question. Just a thought, ~Ray