Hi I have a SQL table as below;
--------------------------
col1 | col2 | col3 | col4|
--------------------------
10 | 20 | 30 | 40 |
15 | 22 | 12 | 21 |
11 | 40 | 50 | 60 |
and I’m trying to delete column specific data from the table. For instance I want to delete 50 and 60 in respective 3rd and 4th columns.
I use the following code but it deletes the entire row which contains 11 and 40 as well. Code is as follows. can some one tell me how to alter my approach below? Thanks.
$result = mysqli_query($con,"DELETE FROM table1 WHERE col1 ='11'");
You need to
updatethe row, instead ofdelete, like this,NOTE:
Updateis used for changing the value in specific columns, keeping the row intact.Deleteis for deleting/removing the entire row, from the table.