Hi all,
I have created the inbox......so now i am deleting the particular row......i want it to be removed from the inbox and moved to trash......can you guide me how to do.
i know simple deleting operation.....help me
Hi all,
I have created the inbox......so now i am deleting the particular row......i want it to be removed from the inbox and moved to trash......can you guide me how to do.
i know simple deleting operation.....help me
Short practical guidance for . was correct to ask for more specifics, and is on the right track by suggesting you avoid immediate hard deletes. Two common, safe patterns are worth considering depending on your needs: flagging rows so they are hidden from the inbox (easy restore, keeps relational integrity), or moving the row to a dedicated trash/archive table (keeps main table smaller but needs careful mapping and transactions). Pick based on expected volume, restore requirements, and retention policy.
Example SQL patterns (adjust column names to your schema):
Soft-delete (mark and hide from inbox)
UPDATE messages
SET deleted_at = NOW(), deleted_by = ?
WHERE id = ? AND owner_id = ?; Inbox query for soft-delete
SELECT * FROM messages
WHERE owner_id = ? AND deleted_at IS NULL
ORDER BY sent_at DESC; Move-to-trash using a transaction (map columns explicitly)
START TRANSACTION;
INSERT INTO messages_trash (id, owner_id, subject, body, sent_at, deleted_at, deleted_by)
SELECT id, owner_id, subject, body, sent_at, NOW(), ?
FROM messages
WHERE id = ? AND owner_id = ?;
DELETE FROM messages WHERE id = ? AND owner_id = ?;
COMMIT; Operational tips: add a deleted_at and deleted_by for auditability, index the columns you filter on (owner_id + deleted_at), use prepared statements and transactions to avoid partial moves, implement a scheduled purge job if you want permanent deletion after a retention period, and ensure server-side permission checks so one user cannot delete another's messages. If attachments or related rows exist, handle those in the same transaction or keep them in separate tables and update references accordingly.
Jump to Post— R0bb0b 344You are going to have to be a lot more specific.
You are going to have to be a lot more specific.
use one state column in your messages table..
and whenever user click on the delete button ,update the state field to 2 by using the id of deleted message.and first set your state as1.
if the state is 1,that is inbox message,
if the state is 2,that is trash message...
implement by this logic....
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.