how to make e-mail system....

making an email system.... using mysql but messages are show horizonta

Page 1 of 1

1 Replies - 4954 Views - Last Post: 16 March 2009 - 12:53 PM Rate Topic: -----

#1 fallen0ne09  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 45
  • Joined: 13-March 09

how to make e-mail system....

Post icon  Posted 15 March 2009 - 07:35 PM

i have a project... and its like an email system... i am using wamp server.... and using insert to send... and to see the message using select.... but the messages are shown horizontally.... not like in yahoo... that it warns the user that there is a new message... and the messages are like hyper links... like...
message from: blalala
message from: dkfjald

here are my codes...
form.php
<html>
<head></head>
<body>
<b>
<a href="main.php"><font size="4">Back To Main Page</font></a><font size="4"> </font></b>
<p align="center"><b>Sending Messages To: Main Branch
</b></p>
<form action="confirm.php" method="post">
<p align="center"><b>Enter message:</b></p>
<p align="center"><textarea name="msg" rows="5" cols="21">

</textarea></br><br>
<input type="submit" name="Send" value="Send Message"><br><br>
<input type="reset" value="Reset">
</p>
</form>
</body>
</html>

confirm.php
<html>
<head>
</head>
<body>
<a href="main.php">Go back to Main</a>
<?php #MySQL-Insert-Into.php
# Copyright (c) 2007 by Dr. Herong Yang, http://www.herongyang.com/
#
  $con = mysql_connect("localhost", "root", "");
  $ok = mysql_select_db("message", $con);
  
  $msg = $_POST['msg'];

  $sql = "INSERT INTO inboxmain (msg)"
	 . " VALUES ('$msg')";
  if (mysql_query($sql, $con)) {
	print("Message Sent:");
	
  } else {
	print("SQL statement failed.\n");
	print(mysql_errno($con).": ".mysql_error($con)."\n"); 
  }
  
  mysql_close($con); 
?>
</body>
</html>


and see.php
<html>
<head>
</head>
<body>
<a href="main.php">Go back to main</a><br><br>
<?php #MySQL-Select-Query.php
# Copyright (c) 2007 by Dr. Herong Yang, http://www.herongyang.com/
#
  $con = mysql_connect("localhost", "root", "");
  $ok = mysql_select_db("message", $con);
  
  $sql = "SELECT * FROM inboxmain ORDER BY ID DESC LIMIT 0, 10";
  $res = mysql_query($sql, $con);
  while ($row = mysql_fetch_array($res)) {
	print("message #".$row['id']."<br>");
	print("   message: ".$row['msg']."<br>");
   
  }  
  mysql_free_result($res);

  mysql_close($con); 
?>


the output of this see.php is
number 1
message: kjsdflkjsdfkj
number 2
message: sdfsdf
and so on.... plsss help me i dont know what to do....

Is This A Good Question/Topic? 0
  • +

Replies To: how to make e-mail system....

#2 kiwi2  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 8
  • View blog
  • Posts: 178
  • Joined: 16-September 08

Re: how to make e-mail system....

Posted 16 March 2009 - 12:53 PM

add a field call it rmsg give a new message when added a numeric value of 1, when the user opens a message page add an insert statement, change the number to 2 using an update string based on the id of the message, now select where rmsg is 1 for unread or new msgs and 2 for old news
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1