liamloveslearning Posted May 30, 2008 Share Posted May 30, 2008 Hi, i plan on adding a "saved msgs" page into my mailing system on my site; im just curious as to how do i go about this? im new to this so im unsure how it would work, would the "save button" update my "saved" value in my message field (in my database) to say 1, then my query on my saved page filter out messages by that "saved" column and then display them to the appropriate user? thanks Link to comment https://forums.phpfreaks.com/topic/108020-saves-messages/ Share on other sites More sharing options...
craygo Posted May 30, 2008 Share Posted May 30, 2008 sounds like a plan Link to comment https://forums.phpfreaks.com/topic/108020-saves-messages/#findComment-553639 Share on other sites More sharing options...
liamloveslearning Posted May 30, 2008 Author Share Posted May 30, 2008 but then, theoretically if the sender deletes the message, wont it dissapear from the "recievers saved box" as its no longer in the db? Link to comment https://forums.phpfreaks.com/topic/108020-saves-messages/#findComment-553688 Share on other sites More sharing options...
craygo Posted May 30, 2008 Share Posted May 30, 2008 theoretically You could always just create another table and just hold the sender_id, recipients_id, and a copy of the message. Then you can easily query by sender_id or recipients_id. Ray Link to comment https://forums.phpfreaks.com/topic/108020-saves-messages/#findComment-553707 Share on other sites More sharing options...
liamloveslearning Posted May 30, 2008 Author Share Posted May 30, 2008 ahh great idea, thanks! Link to comment https://forums.phpfreaks.com/topic/108020-saves-messages/#findComment-553749 Share on other sites More sharing options...
liamloveslearning Posted May 31, 2008 Author Share Posted May 31, 2008 hi, im just wondergin where would my INSERT query in here go? Im looking to insert my message data into a new table upon the user clicking the save button ??? <?php session_start(); $user = $_SESSION['kt_login_id']; //Are they logged in or not? if(!$user) { echo "<br><p>Blah blah you arent logged in and stuff, you should do that or something</p><br>"; } else { //We need to grab the msg_id variable from the URL. $msg_id = $_REQUEST['msg_id']; //Get all of the information about the message with and id number of the one sent through the URL $view_msg = mysql_query("SELECT * FROM messages_test WHERE id = '$msg_id'"); $msg = mysql_fetch_array($view_msg); $reciever = $msg['reciever']; $sender = $msg['sender']; $subject = $msg['subject']; $message = $msg['message']; $datetime = $msg['datetime']; //If the person who is supposed to recieve the message is the currently logged in user everything is good if($reciever == $user) { //The message was recieved, so lets update the message in the database so it wont show up in the sent page any more mysql_query("UPDATE messages_test SET recieved='1' WHERE id = '$msg_id'"); //Lets get the private message count, to display for the user $sql = mysql_query ("SELECT pm_count FROM members WHERE member_id='$user'"); $row = mysql_fetch_array ($sql); $pm_count = $row['pm_count']; //Calculate the percentage full $percent = $pm_count/'50'; $percent = $percent * '100'; //Now we will display the little navigation thing, the fullness of the inbox, then display message information stuff, like who its from, the subject, and the body ?> <center> <b> <table width="100%"> <tr> <td width="94" valign="middle" class="message_header">From</td> <td colspan="3" valign="middle" class="message_rows"><a href = "<?php echo "../member_profile.php?member_id=$sender"; ?>" class="message_rows_subject"><?php echo $sender; ?> <label></label> </a></td> </tr> <tr> <td width="94" valign="middle" class="message_header">Date</td> <td colspan="3" valign="middle" class="message_rows_subject"><?php echo $datetime; ?></td> </tr> <tr> <td width="94" valign="middle" class="message_header">Subject</td> <td colspan="3" valign="middle" class="message_rows_subject"><?php echo $subject; ?></td> </tr> <tr> <td width="94" valign="top" class="message_header">Body</td> <td height="300" colspan="3" valign="top" class="message_rows"><?php echo $message; ?></td> </tr> <tr> <td width="75" valign="top"><form id="form1" name="form1" method="post" action="mail_reply.php?msg_id=<?php echo $msg_id; ?>"> <label> <input type="submit" name="reply" id="reply" value="Reply" /> </label> </form></td> <td width="75" valign="top"><form id="form2" name="form2" method="post" action=""> <label> <input type="submit" name="Save" id="Save" value="Save" /> </label> </form> </td> <td width="75" valign="top"><form id="form3" name="form3" method="post" action="delete.php"> <label> <input type="submit" name="Delete" id="Delete" value="Delete" /> </label> </form> </td> <td width="300" valign="top"> </td> </tr> </table> </center> <?php } //Everything is not good, someone tried to look at somone else's private message else { ?> <p>You cannot view somebody else's messages!</p> <?php } } ?> Link to comment https://forums.phpfreaks.com/topic/108020-saves-messages/#findComment-554078 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.