I'm trying to insert form data into my sql table. The form data is a long questionnaire that has multiple questions. This means that the table I'm inserting into has multiple columns, 30 to be exact.
Is there a way for me to quickly insert one row of 30 columns with minimal or efficient code? Perhaps I can have the "name" value in my form be equal to the variable name in the my table? My form is a mixture of normal text fields and some checkbox groups.
I'm using php and hoping to use mysqli prepared statements.
TLDR: Can I shorten this ?:
$query = "INSERT INTO table (a, b, c, d, e , f , g , h ,i j, ........)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?,....)";
mysqli_stmt_bind_param($stmt,'sssiiisiiiiiiiiiisss...', ....);
Or do I need to just brute force it?