Jump to content

Recommended Posts

Hi guys,

 

On my website on the left hand side http://www.absolutehype.com/index.php i am having problems with my latest posts being badly outputted when special characters are present. For example,

 

HTML Output:

Awesome New Game!&#3...

 

Stored in DB as:

Awesome New Game!!!

 

Basically i am echoing the direct value from the database onto the page but for soem reason the ampersand is automatically being encoded as & and so the HTML cant compile the rest of the symbol sort of thing. I tried alot of bits and pieces now, anyone have any ideas? :/

Link to comment
https://forums.phpfreaks.com/topic/51162-problems-with-and/
Share on other sites

Hmm i tried that before. Same problem :|

 

This is basically what i have atm...

 

foreach ($existing_topics as $value2)
{
	if ($value2==$row[12])
	{
		$existing ++;
	}
}
if ($existing==1 && $admin_forum==FALSE)//If current is a new topic and is not an admin topic
{			
	$query_thread = "SELECT * FROM ibf_topics WHERE tid=$row[12]";//Initialise new thread search
	$result_thread = mysql_query ($query_thread);
	$row_thread = mysql_fetch_array($result_thread, MYSQL_NUM);
	$title = html_entity_decode($row_thread[1]);
	echo '<li><a href="forums/index.php?showtopic='.$row_thread[0].'">'.nicetrim(27, $title).'
			<em>by '.$row_thread[11].'</em><span>'. date('d/m/Y H:i', $row_thread[8]) .'</span></a></li>';
	$count++;
}

 

As far as i know everything is fine. Still cant work why its happening :S

Link to comment
https://forums.phpfreaks.com/topic/51162-problems-with-and/#findComment-252212
Share on other sites

Seems to be a syptom of one htmlentities() too far

 

<?php
<?php
$txt = 'Marks & Spencer';

$txt2 = htmlentities($txt);
echo $txt2;                             // Marks & Spencer

echo '<br>';

$txt3 = htmlentities($txt2);
echo $txt3;                             // Marks & Spencer 
?>

Link to comment
https://forums.phpfreaks.com/topic/51162-problems-with-and/#findComment-252240
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.