Wow that’s a bit of a funny way of doing it. A much easier way would be to use a stylesheet with alink and vlink
alink { font-weight: bold;}
vlink { font-weight: normal;}
I have a members section on a site I'm doing that allows users to send PMs to one another, I have all this bit set up and working fine.
What I want to do is have any unread PMs in bold and any tread PMs not in bold (basically the same way as most PM systems/email work).
I have created it so that when a user has read the PM that the variable "viewed" is updated to be the value of 1 (unread PMs are 0).
Is anyone able to help please?!PHP Code:$query = "SELECT * FROM userspm WHERE user='$user' ORDER BY messageid DESC LIMIT $limitvalue, $limit";
$result = mysql_query($query) or die("Error: " . mysql_error());
if(mysql_num_rows($result) == 0){
echo("No Private Messages");
}
$bgcolor = "#FFFFFF"; //
$bgcolor2 = "#BFDFFF"; //
$bgcolor3 = "#FFCC33"; //
$bgcolor4 = "#FFDF80"; //
$bgcolor5 = "#FFEEB9"; //
$font = "Verdana, Arial, Helvetica, sans-serif"; //
$fontsize = "2"; //
$tdwidth = "150"; //
$tdwidth2 = "300"; //
echo("<table>");
echo("<tr bgcolor=".$bgcolor.">\n<td>");
echo("<td width=".$tdwidth." bgcolor=".$bgcolor.">");
echo("<font face=".$font."><B>");
echo("<font size=".$fontsize.">");
echo('Sender');
echo("<td width=".$tdwidth2." bgcolor=".$bgcolor.">");
echo("<font face=".$font.">");
echo("<font size=".$fontsize."><B>");
echo('Subject');
echo("<td width=".$tdwidth." bgcolor=".$bgcolor.">");
echo("<font face=".$font.">");
echo("<font size=".$fontsize."><B>");
echo('Date');
while($row = mysql_fetch_array($result)){
if ($bgcolor == "#FFFFFF"){
$bgcolor = "#FFFFFF";
}else{
$bgcolor = "#FFFFFF";
}
echo("<tr bgcolor=".$bgcolor.">\n<td>");
echo("<td width=".$tdwidth." bgcolor=".$bgcolor.">");
echo("<font face=".$font.">");
echo("<font size=".$fontsize.">");
echo('' . $row["username"] . '');
echo("<td width=".$tdwidth2." bgcolor=".$bgcolor.">");
echo("<font face=".$font.">");
echo("<font size=".$fontsize.">");
echo('<a href="http://www.mysite.com/read-message.php?mid=' . $row["messageid"] . '">' . $row["pmtitle"] . '</a></div>');
echo("<td width=".$tdwidth." bgcolor=".$bgcolor.">");
echo("<font face=".$font.">");
echo("<font size=".$fontsize.">");
echo('' . $row["date"] . '');
}
echo("</table>");
?></font>
Cheers
Wardy
Wow that’s a bit of a funny way of doing it. A much easier way would be to use a stylesheet with alink and vlink
alink { font-weight: bold;}
vlink { font-weight: normal;}
Don;t know any PHP but I've done similar in ASP.
Logic wise you'de need two lines something like.
If viewed = 1 then print out HTML in bold
If viewed = 0 then print out HTML normal
In ASP it would be
If viewed=0 Then Response.Write("<b>" & PM & "</b>")
If viewed=1 Then Response.Write PM
Or you could do it by setting the <b> tag at the top of the code dependant on what the variable is.
EG.
If viewed = 1 then return a <b> tag
PM code stuff
If viwed = 1 then return a </b> tag
Either should work.
Jon
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks