Jump to content

Recommended Posts

sorry i don't understand. I didn't strip the newline but where do i put the nl2br() about?

 

Code for displaying message:

<?php
session_start();
require_once('auth.php');
ini_set('display_errors', 'on');
error_reporting(E_ALL);
$id=$_SESSION['SESS_MEMBER_ID'];
$mid=$_GET['mid'];
include("config.php");
mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);
@mysql_select_db(DB_DATABASE) or die( "Unable to select database");
$query="SELECT * FROM messages WHERE msg_id='$mid'";
$result=mysql_query($query) or trigger_error('Query error! Query: <pre>'.$query.'</pre>Reason: ' . mysql_error());
$num=mysql_numrows($result); 
$readqry="UPDATE messages SET viewed='1' WHERE msg_id='$mid'";
$markasread=mysql_query($readqry);


$i=0;
while ($i < $num) {
$from_id=mysql_result($result,$i,"sender_id");
$to_id=mysql_result($result,$i,"to_id");
$subject=mysql_result($result,$i,"subject");
$message=mysql_result($result,$i,"message");

if ($to_id != $id) {
   echo "<h1>This isn't Your Message!</h1>";
   header("location: message-inbox.php");
   exit();
}
$query2="SELECT * FROM members WHERE member_id='$from_id'";
$result2=mysql_query($query2) or trigger_error('Query error! Query: <pre>'.$query2.'</pre>Reason: ' . mysql_error());

$sender_firstname=mysql_result($result2,$i,"firstname");
$sender_lastname=mysql_result($result2,$i,"lastname");
mysql_close()
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Message</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
</head>
<body text="#0000ff" link="#00a5e9" vlink="#00a5e9" alink="#00a5e9" leftmargin="2" topmargin="2" marginwidth="2" marginheight="0">
<table width=100% class=tableborder>
<h1>Message</h1><br>
<tr><td><b>From:</b></td><td><? echo $sender_firstname." ".$sender_lastname; ?></td></tr>
<tr><td><b>Subject:</b></td><td><? echo $subject; ?></td></tr>
<tr><td valign=top><B>Message:</b></td><td><? echo $message; ?></td></tr>
<tr><td><input type="button" value="Reply"
onClick="location.href='send-message.php?sendto=<? echo $from_id; ?>&subject=<? echo $subject; ?>';"></td></tr></table>
<?php
++$i;
}
?>
</body></html>

it really depends on your system

You can use nl2br before insertion,  so its ready to display, problem is that if u update the msg you have to process it to show original message

after a SELECT, its in its orginal form, you have to make it ready for display, but makes updates easier

 

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.