Jump to content

mysql php display row and links


marksie1988

Recommended Posts

ok i have a script which shows news on my webpage when a user clicks a link from my rss feed.

 

but if the news has any links within it it will not link them why is this? i think i need to change this row

 

        $news = nl2br (strip_tags ($row['newstext'], '<a><b><i><u>'));

 

but i dont know what to...

 

here is the full php so you can understand the script.

 

<?php

if(ctype_digit($_GET['id']))
   $article_id = $_GET['id'];
else
   $article_id = 0;
$query = "SELECT * FROM `news` WHERE `id` = '" . $article_id . "' LIMIT 1;";  
$result = mysql_query($query);

if(mysql_num_rows($result) == 0) {
echo "<h5 class=\"style2\">There is no news with this article id</h5>";
}
else{
while ($row = mysql_fetch_assoc ($result)) {

        /* place table row data in 
         * easier to use variables.
         * Here we also make sure no
         * HTML tags, other than the
         * ones we want are displayed */
        $date = date("D d M Y h:i:s e", $row['postdate']);
        $title = htmlentities ($row['title']);
        $news = nl2br (strip_tags ($row['newstext'], '<a><b><i><u>'));
        
        /* display the data */
  

  $td = "<td align=\"left\" >";
  $ttl = "align=\"center\" style=\"font-size:13px; color:#ffffff; font-family:tahoma\"";
  $dte = "align=\"center\" style=\"font-size:10px; color:#CA3C30; font-family:tahoma\"";
  $nws = "align=\"center\" style=\"font-size:12px; color:#999999; font-family:tahoma\"";



echo "<strong $ttl> \n $title </strong>\n <br>\n";
echo "<strong $dte> \n $date </strong>\n <br><br>\n";
echo "<strong $nws> \n $news </strong>\n <br><br>\n";

}
}
?>

 

help would be appreciated  8)

Link to comment
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.