I have 2 tables in a MySQL database which are
'users' and
'tasks'
The 'users' table has 15 coloumns named 'task_name1' to 'task_name15'.
In the below PHP code, i need to update the information in the 'users' table for each of the columns
but the sql query for update (in the below code) is not working in PHP.
Can anyone help please to fix this problem. Thanks
##############
PHP Code below...
##############
If the value for a task is equal to "00001", then update the relevant column in the users table to $this_id (which i get from the user)
if($task1 == "00001") { mysql_query("UPDATE users SET task_name1 = '$this_id' WHERE id='$id'"); }
else if($task2 == "00001") { mysql_query("UPDATE users SET task_name2 = '$this_id' WHERE id='$id'"); }
else if($task3 == "00001") { mysql_query("UPDATE users SET task_name3 = '$this_id' WHERE id='$id'"); }
else if($task4 == "00001") { mysql_query("UPDATE users SET task_name4 = '$this_id' WHERE id='$id'"); }
else if($task5 == "00001") { mysql_query("UPDATE users SET task_name5 = '$this_id' WHERE id='$id'"); }
else if($task6 == "00001") { mysql_query("UPDATE users SET task_name6 = '$this_id' WHERE id='$id'"); }
else if($task7 == "00001") { mysql_query("UPDATE users SET task_name7 = '$this_id' WHERE id='$id'"); }
else if($task8 == "00001") { mysql_query("UPDATE users SET task_name8 = '$this_id' WHERE id='$id'"); }
else if($task9 == "00001") { mysql_query("UPDATE users SET task_name9 = '$this_id' WHERE id='$id'"); }
else if($task10 == "00001") { mysql_query("UPDATE users SET task_name10 = '$this_id' WHERE id='$id'"); }
else if($task11 == "00001") { mysql_query("UPDATE users SET task_name11 = '$this_id' WHERE id='$id'"); }
else if($task12 == "00001") { mysql_query("UPDATE users SET task_name12 = '$this_id' WHERE id='$id'"); }
else if($task13 == "00001") { mysql_query("UPDATE users SET task_name13 = '$this_id' WHERE id='$id'"); }
else if($task14 == "00001") { mysql_query("UPDATE users SET task_name14 = '$this_id' WHERE id='$id'"); }
else if($task15 == "00001") { mysql_query("UPDATE users SET task_name15 = '$this_id' WHERE id='$id'"); }