基本上,这段代码有效,但它以相同的颜色显示发送者和接收者我想要什么?我希望发件人颜色与收件人消息颜色不同
<?php
require_once 'cn.php';
session_start(); // startsession .line17 (username || usernameto='.$username.')
//messages sent or received by the $_SESSION or $_GET["ident"]..line 26
require_once 'protect.php';
$username=$_SESSION['UserID'];
$fiveMinutesAgo = time() - 1000;
$to=$_SESSION['UserTo'];
$sql = 'SELECT
username, message_content,message_file, message_time,usernameto
FROM
messages
WHERE
message_time > ' . $fiveMinutesAgo . '
and ((username='.$username.'
and usernameto='.$to.') or (usernameto='.$username.'
and username='.$to.'))
ORDER BY
message_time';
$result = mysql_query($sql, $cn) or
die(mysql_error($cn));
//mysql_query ("Update messages set message_file= replace(message_file,' ','');
while ($row = mysql_fetch_assoc($result)) {
$hoursAndMinutes = date('g:ia', $row['message_time']);
$mycontent=$row['message_content'];
$myfile=$row['message_file'];
$playfile="<A href=upload/$myfile> $myfile </A>";
/*************************************************************************************************/
echo '<i><p style="font-family:arial;color:purple;font-size:15px;"><strong>' . $row['username']. '</strong>: <em>(' . $hoursAndMinutes . ')</em> ' . $playfile . $mycontent.'</i></p>';
}
?>