w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
flag record as delete instead of deleting the record from mysql table

Easiest way is to add a new BOOL column to the table like enabled with a default value of 1.

Then UPDATE table_name SET enabled = 0 when you would like to "delete" the row.

And filter out "deleted" rows in your queries like:

SELECT * FROM table_name WHERE ... AND enabled = 1

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.