Jump to content

link


adam291086

Recommended Posts

Ok i have some content coming from my database. When i look at the source code the links are correct http://www.eastyorkshireclassic.co.uk/nationals/cyclosportive.aspx but when i click on the link the page goes to here http://www.bcyorkshire.co.uk/%5C%22http://www.eastyorkshireclassic.co.uk/nationals/cyclosportive.aspx%5C%22 you can see whats happening here

 

http://www.bcyorkshire.co.uk/shownews.php?news=196, its the link at the bottom of the page

Link to comment
https://forums.phpfreaks.com/topic/112623-link/
Share on other sites

ok

 

this is how i display the news articles as links, these links take you to the full news article

 

 <?php

include '../database/config.php';



$result = mysql_query("SELECT * FROM `News` WHERE `page` LIKE '%BCYorkshire%' ORDER BY `news_id` DESC Limit 5  ") or die(mysql_error());

while($row = mysql_fetch_array($result))

{

$id = $row['news_id'];

$titlenews = $row['News_title'];



$tmpString = $titlenews;



//convert all types of single quotes

$tmpString = str_replace(chr(145), chr(39), $tmpString);

$tmpString = str_replace(chr(146), chr(39), $tmpString);

$tmpString = str_replace("'", "&#39;", $tmpString);



//convert all types of double quotes

$tmpString = str_replace(chr(147), chr(34), $tmpString);

$tmpString = str_replace(chr(148), chr(34), $tmpString);

$tmpString = str_replace("\"", "\"", $tmpString);



//replace carriage returns & line feeds

$tmpString = str_replace(chr(10), " ", $tmpString);

$tmpString = str_replace(chr(13), " ", $tmpString);

$tmpString = str_replace("å", " ", $tmpString);



$titlenews = $tmpString;

?>

  

  

  <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr align="left" id="newstitle" >

      <th><?php echo '<a href="http://www.bcyorkshire.co.uk/admin/news/shownews.php?news='.urlencode($id).'">'.$titlenews.'</a>'?></th>

              <br />

    </tr>



    

  </table>

<br />

  <?php

} 

include '../database/closedb.php';

?>

 

then showing the news article i do

 

 <?php

include '../database/config.php';

$id = $_GET['news'];

mysql_real_escape_string($id);

$result = mysql_query("SELECT *FROM `News`WHERE `news_id` =$id") or die(mysql_error());

while($row = mysql_fetch_array($result))

{$id = $row['news_id'];

$titlenews = $row['News_title'];

$news = $row['News'];

?>

      <div class="maintexttitle"><?php echo $titlenews; ?><br /> </div>
<br />

    

      <div class="maintext"><?php echo $news; ?>

        <p>

<?php } 

include '../../database/closedb.php';

?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/112623-link/#findComment-578397
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.