m00nz00mer Posted March 24, 2008 Share Posted March 24, 2008 hey, can someone tell me how to change the & in database content to & so that i can validate it. Cheers. Link to comment https://forums.phpfreaks.com/topic/97612-ampersands-in-database-content/ Share on other sites More sharing options...
trq Posted March 24, 2008 Share Posted March 24, 2008 Leave the contents in the db as is, use htmlspecialchars on the data when retrieving it if need be. Link to comment https://forums.phpfreaks.com/topic/97612-ampersands-in-database-content/#findComment-499414 Share on other sites More sharing options...
m00nz00mer Posted March 24, 2008 Author Share Posted March 24, 2008 thanks, so if i have this code... $result = mysql_query("SELECT one, two FROM numbers ORDER BY one"); while($row = mysql_fetch_array($result)) { //Display the results with links to each category echo '<div class="numberlinks"><div class="text">number: </div><a href="numbers.php?numberID='.$row['numberID'].'">'.$row['numerDesc'].'</a></div><br />'; how could i use htmlentities on that^? Link to comment https://forums.phpfreaks.com/topic/97612-ampersands-in-database-content/#findComment-499440 Share on other sites More sharing options...
trq Posted March 24, 2008 Share Posted March 24, 2008 htmlentities($row['numerDesc']) Link to comment https://forums.phpfreaks.com/topic/97612-ampersands-in-database-content/#findComment-499443 Share on other sites More sharing options...
m00nz00mer Posted March 24, 2008 Author Share Posted March 24, 2008 thanks Link to comment https://forums.phpfreaks.com/topic/97612-ampersands-in-database-content/#findComment-499451 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.