absolutehype Posted May 13, 2007 Share Posted May 13, 2007 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!... 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? :/ Quote Link to comment https://forums.phpfreaks.com/topic/51162-problems-with-and/ Share on other sites More sharing options...
papaface Posted May 13, 2007 Share Posted May 13, 2007 try: html_entity_decode($fromdb); http://uk.php.net/manual/en/function.html-entity-decode.php Quote Link to comment https://forums.phpfreaks.com/topic/51162-problems-with-and/#findComment-251908 Share on other sites More sharing options...
absolutehype Posted May 13, 2007 Author Share Posted May 13, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/51162-problems-with-and/#findComment-252212 Share on other sites More sharing options...
Alith7 Posted May 13, 2007 Share Posted May 13, 2007 maybe try: $title = htmlspecialchars_decode($row_thread[1]); since the problem you're having is with HTML Special chars and no the HTML entities? see here: http://us.php.net/manual/en/function.htmlspecialchars-decode.php Quote Link to comment https://forums.phpfreaks.com/topic/51162-problems-with-and/#findComment-252225 Share on other sites More sharing options...
absolutehype Posted May 13, 2007 Author Share Posted May 13, 2007 Hmm didnt work, im using PHP v4.4.6 and MySQL v4.1.20 Dont think its supported :S Ill check that link though and see if i can cough anything up. Quote Link to comment https://forums.phpfreaks.com/topic/51162-problems-with-and/#findComment-252233 Share on other sites More sharing options...
Alith7 Posted May 13, 2007 Share Posted May 13, 2007 oops. didn't notice that... Quote Link to comment https://forums.phpfreaks.com/topic/51162-problems-with-and/#findComment-252239 Share on other sites More sharing options...
Barand Posted May 13, 2007 Share Posted May 13, 2007 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 ?> Quote Link to comment https://forums.phpfreaks.com/topic/51162-problems-with-and/#findComment-252240 Share on other sites More sharing options...
absolutehype Posted May 15, 2007 Author Share Posted May 15, 2007 Anyone found anything else out that might help? still having the problem Quote Link to comment https://forums.phpfreaks.com/topic/51162-problems-with-and/#findComment-253885 Share on other sites More sharing options...
Alith7 Posted May 15, 2007 Share Posted May 15, 2007 crazy idea, and maybe you have tried it, but have you tried posting -without- using any kind of decode, just posting what's in the DB row? Quote Link to comment https://forums.phpfreaks.com/topic/51162-problems-with-and/#findComment-253914 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.