chocopi Posted June 12, 2007 Share Posted June 12, 2007 Am I using this wrongly ? My data is submitted into the database using htmlspecialchars(), but when I retrieve the data and then try and decode it, I get this error: Call to undefined function: htmlspecialchars_decode() on line 6 Line 6: $text = htmlspecialchars_decode($text); Thanks, ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/55312-solved-htmlspecialchars_decode/ Share on other sites More sharing options...
The Little Guy Posted June 12, 2007 Share Posted June 12, 2007 No... What version on PHP are you using? You need PHP 5+ other wise use this: html_entity_decode($text); Link to comment https://forums.phpfreaks.com/topic/55312-solved-htmlspecialchars_decode/#findComment-273410 Share on other sites More sharing options...
chocopi Posted June 12, 2007 Author Share Posted June 12, 2007 Yea im not using 5< so it didnt work Just out of intrest should i bother using addslashed() is im using htmlentities() ? THANKS little_guy, ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/55312-solved-htmlspecialchars_decode/#findComment-273415 Share on other sites More sharing options...
kenrbnsn Posted June 12, 2007 Share Posted June 12, 2007 Why are you using htmlspecialchars() when storing your data? You probably want to use the function mysql_real_escape_string() instead. Ken Link to comment https://forums.phpfreaks.com/topic/55312-solved-htmlspecialchars_decode/#findComment-273416 Share on other sites More sharing options...
chocopi Posted June 12, 2007 Author Share Posted June 12, 2007 so i can stop " ' & < > being entered into my database Link to comment https://forums.phpfreaks.com/topic/55312-solved-htmlspecialchars_decode/#findComment-273418 Share on other sites More sharing options...
kenrbnsn Posted June 12, 2007 Share Posted June 12, 2007 Use the function mysql_real_escape_string() for that. Escaping those characters (and a few others) is it's function. Ken Link to comment https://forums.phpfreaks.com/topic/55312-solved-htmlspecialchars_decode/#findComment-273419 Share on other sites More sharing options...
chocopi Posted June 12, 2007 Author Share Posted June 12, 2007 okie dokie, i will change it, Cheers Ken Link to comment https://forums.phpfreaks.com/topic/55312-solved-htmlspecialchars_decode/#findComment-273427 Share on other sites More sharing options...
chocopi Posted June 12, 2007 Author Share Posted June 12, 2007 so doing something like this is better $original = mysql_real_escape_string($original); than $original = htmlentities($original); ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/55312-solved-htmlspecialchars_decode/#findComment-273430 Share on other sites More sharing options...
The Little Guy Posted June 12, 2007 Share Posted June 12, 2007 for SQL, Yes Link to comment https://forums.phpfreaks.com/topic/55312-solved-htmlspecialchars_decode/#findComment-273437 Share on other sites More sharing options...
chocopi Posted June 12, 2007 Author Share Posted June 12, 2007 kool Cheers everyone ;D Link to comment https://forums.phpfreaks.com/topic/55312-solved-htmlspecialchars_decode/#findComment-273439 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.