Hello, I currently have a list of things to update in the given mysqli query:
$insert = mysqli_query($db,"UPDATE `tbl_perms` SET
`1` ='" . mysqli_real_escape_string($db,$_POST['permsA_1']) . "',
`2` ='" . mysqli_real_escape_string($db,$_POST['permsA_2']) . "',
`3` ='" . mysqli_real_escape_string($db,$_POST['permsA_3']) . "',
`4` ='" . mysqli_real_escape_string($db,$_POST['permsA_4']) . "',
`5` ='" . mysqli_real_escape_string($db,$_POST['permsA_5']) . "',
`6` ='" . mysqli_real_escape_string($db,$_POST['permsA_6']) . "',
`7` ='" . mysqli_real_escape_string($db,$_POST['permsA_7']) . "',
`8` ='" . mysqli_real_escape_string($db,$_POST['permsA_8']) . "',
`9` ='" . mysqli_real_escape_string($db,$_POST['permsA_9']) . "',
`10` ='" . mysqli_real_escape_string($db,$_POST['permsA_10']) . "'
WHERE `userid` = '$id' ")or die(mysqli_error($db));
How would I rewrite this so that I don't have to manually code the sql in so that when "permissions" are added, this automatically generates the sql needed to do the sql query?
Thanks.