Hide registration to the user

Asked

Viewed 50 times

0

When "delete" an accurate record hides it from a table, in the user view, but it must remain in the database. I put a field called 'status' on the table that manages just that. In the exhibition I put one 'if' performing the filter at select. Showing only records with the 'status == 1'.

So far so good, my problem is giving the 'update' to exchange only the value of 'status' from 1 to 0. At the time the user decides to delete.

2 answers

1

When trying to Delete check the status of the record, and if it is 1 updates to 0 and passes the bank pointer to the next record.

0


If your case is only to update in the database this example solves:

UPDATE COMPANY SET ADDRESS = 'Texas' WHERE ID = 6;

UPDATE sua_tabela SET seu_campo = valor_para_alterar WHERE ID = id_que_sera_atualizado;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.