Jump to content

Recommended Posts

I am trying to apply css to individual section of the below code. It is basically recent posts that show up on the front page to my site. I want each recent post to consist of 3 lines, the thread topic bold, the poster name in italic and a color and then on the 3rd line, the date and time of the post in italic. Can anyone help me out?

 

 

//Edit these parameters:

        //MySQL server adress
        $host="p50mysql271.secureserver.net";

        //Username
        $user="";

        //Password
        $pass="";

        //Database
        $db="";

        //Table prefix
        $table="phpbb_";

        //Show last x topics
        $laforums="5";
     


    $link=mysql_connect($host, $user, $pass);
    $db=mysql_select_db($db);
    $query="select * from $table".topics."  WHERE topic_approved = '1' order by topic_last_post_time desc limit 0,$laforums";
    $query2="select config_name,config_value from $table".config." where config_name = 'server_name' limit 0,1";
   $result2=mysql_query($query2);
    $row2 = mysql_fetch_array($result2);
    extract($row2);
    $result=mysql_query($query);
    while ($row=mysql_fetch_array($result)) {
    extract($row);
    $date = date("F j, Y, g:i a", $topic_last_post_time );
   $query3="select forum_name from $table".forums." WHERE forum_id = ".$forum_id."";
   $result3=mysql_query($query3);
   $row2 = mysql_fetch_array($result3);
  echo "<a href='http://".$config_value."/forums/viewforum.php?f=".$forum_id."' target='_blank'>".$row2[forum_name].":</a> <a href='http://".$config_value."/forums/viewtopic.php?f=".$forum_id."&t=".$topic_id."' target='_self'>".$topic_title."</a>,Last Post By: ".$topic_last_poster_name.",Posted On: ".$date."<br><br>\n";
    }

    //-------------------------- END
    ?>

Link to comment
https://forums.phpfreaks.com/topic/163305-apply-css-to-php/
Share on other sites

Well... this is the current line for displaying the results:

echo "<a href='http://".$config_value."/forums/viewforum.php?f=".$forum_id."' target='_blank'>".$row2[forum_name].":</a> <a href='http://".$config_value."/forums/viewtopic.php?f=".$forum_id."&t=".$topic_id."' target='_self'>".$topic_title."</a>,Last Post By: ".$topic_last_poster_name.",Posted On: ".$date."<br><br>\n";

 

What do you have so far?

 

edit: and does your query(ies) return the data you want?  Looking at it, I don't know that it does?

Link to comment
https://forums.phpfreaks.com/topic/163305-apply-css-to-php/#findComment-862428
Share on other sites

Well, from what I can tell, you just need to use these values from your existing script, and apply the CSS as wanted.

echo "<a href='http://".$config_value."/forums/viewforum.php?f=".$forum_id."' target='_blank'>".$row2[forum_name].":</a><br>By: ".$topic_last_poster_name."<br>".$date."<br><br>\n";

Link to comment
https://forums.phpfreaks.com/topic/163305-apply-css-to-php/#findComment-863874
Share on other sites

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.