I have an MySQL database which contains columns for ID as well as some answer possibilities for questions on client.
ID | q1 | q2 | ...
1 | answer 1 | answer 2 | ...
I have to adjust the entry-row dynamically, depending from the approach of the website-user (no static form).
I tried the following statement for UPDATE the database entry:
'UPDATE questions SET ? = ? WHERE id = ?', [data.qId, data.answer, id],
but it doesn´t works. when I change the first ?
to the exactly column name q2
(and clear the array to this ?
)it works great.
Is there any possibility for this kind of dynamic column statement, because the http.request contains only the specific answer and I hope, I can solve this with an SQL statement and not with more logic in the backend.
Thanks in advance.