3 Replies - 2833 Views - Last Post: 07 December 2009 - 07:04 AM Rate Topic: -----

#1 chris_s_22  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 74
  • Joined: 27-December 08

internal mail

Posted 05 December 2009 - 04:44 PM

im trying to create a internal mail message system.
though I keep running into problems can anyone point me in direction of a good tutorial or help me with mine?

so far i got my database.
a page that displays list of messages in brief
a page that displays list of messages sent in brief

now i want to be able to delete messages

This is code im using to display messages. i also added a form as i thought i need some kind of checkbox and somedata
to be passed then on the maildelete.php im struggling to figure out what i should be checking for and my query
<?php 
include_once 'Connect.php'; //This starts session, connect to database and calls any functions needed
$usernameid = $_SESSION['id'];
	$query = ("SELECT * FROM mail WHERE messageto = '$usernameid' ");
	$result = mysql_query($query) or die ('failed query.');
	$exist = mysql_num_rows($result);  
	if($exist=='0')
	{
	echo"You have no mail";
	}
	else
	{	echo "<form action='maildelete.php' method='POST' name='delete'>";
		echo "<table border='1' cellspacing='1' cellpadding='1'>";
		echo "<tr><td></td><td>FROM</td><td>SUBJECT</td></tr>";
		while ($row = mysql_fetch_assoc($result)) 
		{	  
		$messagefrom = $row["messagefrom"];
		$messagedate = $row["date"];
		$subjecttitle = $row["subjecttitle"];
		$message = $row["message"]; 
		echo "<tr><td><input name='checkdelete' type='checkbox' value='1'></td>";	
		echo "<td>$messagefrom</td>";
		echo "<td><div align='left'>$subjecttitle</div>";
		echo "$message - only want it to display 1st 50 characters...<br>";
		echo "<div align='right'>$messagedate</div></td></tr>";
		}
		echo "<tr><td><input type='submit' value='DELETE' name='submit'></td></tr></table></form>";
	}
?>


Is This A Good Question/Topic? 0
  • +

Replies To: internal mail

#2 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: internal mail

Posted 05 December 2009 - 11:11 PM

A tutorial on PM System
Creating a simple PM system

Hope it helps :)
Was This Post Helpful? 0
  • +
  • -

#3 ghqwerty  Icon User is offline

  • if($spareTime > 0){ $this->writeCode(); }
  • member icon

Reputation: 43
  • View blog
  • Posts: 903
  • Joined: 08-August 08

Re: internal mail

Posted 06 December 2009 - 01:54 AM

just as a reccommendation i wouldnt 'delete' your messages from your db i would simply add a column to it with a 'deleteStatus' on it and then simply filter the ones which are set to 1(deleted) when you call the messages.

this way if you have any confrontations etc people cant delete the evidence. just might make it easier in the future.
Was This Post Helpful? 0
  • +
  • -

#4 batesy3k  Icon User is offline

  • D.I.C Regular

Reputation: 41
  • View blog
  • Posts: 299
  • Joined: 10-September 09

Re: internal mail

Posted 07 December 2009 - 07:04 AM

plus also doing it the way ghqwerty suggested, they could be deleted after x days using a cron job if you had a message saying like "all deleted messages will get destroyed after 90days"
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1