Jump to content

private message system


magcr23
Go to solution Solved by magcr23,

Recommended Posts

Hi guys, as everybody know, in any message system we can delete the message, but i don't want do delete, i want to hide it from the users.

 

An example of what i want:

miguel sent a message to admin

after admin read it appears for both users the link"delete", but it will only hide the message from the user who pressed the link, the other one will be able to see the message whenever he want.

 

I have this data base: id, from, to, subject, message, date, raiz, read, visible

 

and this code:

  • to show the button:
while($ln = mysqli_fetch_assoc($result)){
 if($ln['raiz'] == 0 && $ln['visible'] == 1){
  echo '<a href="mostraMSG.php?message='.$ln['id'].'"><h2>'.$ln['subject'].'</a><small> para: '. $ln['to'] .'</small></h2>';

  if($ln['read'] == 1){
   echo '<a href="esconder.php?delete='.$ln['id'].'">apagar</a>';
  }
 }					
}
  • to hide the message:
$update = "UPDATE `messages` SET `visible` = 0 WHERE `id` = '$esconder'";
mysqli_query($con, $update);

The problem is if i do this update, it will hide for both of them,

How can i make it hide for the one who pressed the link?

Link to comment
Share on other sites

  • 4 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.