Jump to content
MakeWebGames

Recommended Posts

Posted

Ive been looking around for a mailbox mod that if a user goes to delete the message it doesnt delete it from the db just hides it from there mailbox so only i can delete the messages after i decide if i want to read all of them or not any help would be great

Posted

its simply run this query

ALTER TABLE `mail` ADD `hide` int(11) NOT NULL;

Find

$q=$db->query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_from=u.userid WHERE m.mail_to=$userid ORDER BY mail_time DESC LIMIT 25");

and replace it with the following code in mailbox.php

$q=$db->query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_from=u.userid WHERE m.mail_to=$userid AND m.hide='0' ORDER BY mail_time DESC LIMIT 25");

and than find

$db->query("DELETE FROM mail WHERE mail_id={$_GET['ID']} AND mail_to=$userid");

replace it with the following code

$db->query("UPDATE mail SET hide='1' WHERE mail_id={$_GET['ID']} AND mail_to=$userid");

hope it works

Posted
Yea or he could simply create another table and just have it insert into both and only delete from 1 O.o

Why the "h" would you do that for? No point in doing such thing. The technique prototype suggests is a whole lot better. You run less queries, you only keep the data once.

Posted

Yeah, I think ill stick to prototypes way. Adding another table is just too much for me just to keep duplicate info but thanks everyone for your help now I can bust those sneaky, pesky people advertising or bartering from one game to another

Posted
its simply run this query

ALTER TABLE `mail` ADD `hide` int(11) NOT NULL;

Find

$q=$db->query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_from=u.userid WHERE m.mail_to=$userid ORDER BY mail_time DESC LIMIT 25");

and replace it with the following code in mailbox.php

$q=$db->query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_from=u.userid WHERE m.mail_to=$userid AND m.hide='0' ORDER BY mail_time DESC LIMIT 25");

and than find

$db->query("DELETE FROM mail WHERE mail_id={$_GET['ID']} AND mail_to=$userid");

replace it with the following code

$db->query("UPDATE mail SET hide='1' WHERE mail_id={$_GET['ID']} AND mail_to=$userid");

hope it works

Well, i got no errors which was great so thumbs up for that one but its not hiding them in the inbox

 

The words `data normalization` spring to mind. Duplicating data is normally a

bad idea. A `deleted` field containing the timestamp (or datetime) the record

was flagged as being deleted is about the only difference I'd suggest; that or

shrink your data type to a boolean (tinyint(1)) if you insist on using `hide`.

That would sound good if I had any idea what your talking about lol. Im a huge n00b so what your saying to me sounds like wookie. Im still trying to learn as much as i can but i still have trouble with the SQL and all te terminology of it sorry!!!

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.   Paste as plain text instead

  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...