Results 1 to 3 of 3

 

Thread: PHP/Mysql displaying certain results in bold

  1. #1
    This is the one

    Status
    Offline
    Join Date
    Aug 2003
    Posts
    2,882
    Thanks
    29
    Thanked 9 Times in 7 Posts


    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).

    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> 
    Is anyone able to help please?!

    Cheers
    Wardy

  2. #2
    Ste
    It's a hard life .....

    Status
    Offline
    Join Date
    Apr 2004
    Location
    Lancashire
    Posts
    621
    Thanks
    0
    Thanked 1 Time in 1 Post
    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;}
    B-Link - UK Link Exchange Directory
    PRBox - Free UK Press Releases - Submit Yours Free

  3. #3
    uklejon's Avatar
    Registered User

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Shropshire
    Posts
    840
    Thanks
    0
    Thanked 1 Time in 1 Post
    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



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Google Sued for Low Rankings
    By Another Media in forum Affiliate Marketing Lounge
    Replies: 66
    Last Post: 26-04-07, 11:57 PM
  2. google to expand into CPA
    By betterHalf in forum Affiliate Marketing Lounge
    Replies: 23
    Last Post: 30-06-06, 12:53 PM
  3. Minimum requirements for displaying PPC results
    By hoppy in forum Affiliate Marketing Lounge
    Replies: 2
    Last Post: 30-12-04, 08:48 PM
  4. ASOS Audit Results
    By jesss1 in forum Affiliate Marketing Lounge
    Replies: 13
    Last Post: 27-02-04, 10:14 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2