Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9222993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:58:01+00:00 2026-06-18T03:58:01+00:00

I am currently stuck with my logic. I have created a database table for

  • 0

I am currently stuck with my logic.

I have created a database table for snedimg messages

table messages looks like this

id | sender_id | reciver_id | msg                      | send_date |
1  | 2         |  6         | hello there i am testing | 2013-01-15 

So what i am totally stuck with is the removing the message logic.
The problem what i dont understand how to solve is, lets say user with the id 6 gets the message, and removes it by id, that way who sent the message wont be able to see it either.

So i am a bit lost at this, if someone could give me a hint on a logic i would really be happy

EDIT WITH MORE EXPLAINED DETAILS

So the problem is

id | sender_id | reciver_id | msg                      | send_date |
1  | 2         |  6         | hello there i am testing | 2013-01-15 

this is the table. User recives the message, reads it, and for some reason wants to remove it.

Probmel is the DELETE LOGIC, i know how to delete rows, what i dont know is how to solve the problem if the reciver deletes the message, the sender will be able to see it un the he/she deletes it.

For example on facebook they use archive instead of delete, this is the logic what i dont understand

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:58:02+00:00Added an answer on June 18, 2026 at 3:58 am

    Just set the reciver or sender id to -1 on deletion and have a check afterwards if both are -1 (or would be -1) delete that row.

    e.g.

    on deletion by reciver:
    if ($sender_id == -1) {
      $query = "DELETE FROM messages WHERE id=$id";
    } else {
      $query = mysql_query("UPDATE messages SET reciver_id=-1 WHERE id=$id";
    }
    mysql_query($query)
    

    That way it would be still availabe until both delete it

    Edit:
    Just as additional thought for that solution:
    You could set both to -1 instead of deleting it on the second user deletion so you got a kind of archive and delete too old ones by a cronjob.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently stuck at this problem right now where I don't seem to
I'm currently stuck on this problem. I've hooked into the method_missing function in a
Hello Everyone i am new to android and i am currently stuck on this.
I have created a basic servlet to handle logins on my web app. currently
I'd like to have your opinion on a specific case, please. This is about
I have been fighting with this for days now. I have created my own
I am currently stuck at the part whenever I drag a HTML5 slider, it
I'm currently stuck with using Atom CPU desktop for my Android app development. What
I am currently stuck on the part where user use his username and password
I am currently stuck, having two separate glossaries: main & acronyms . Acronyms glossary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.