I have a text field in my database and in it i use ampersands in the actual content e.g. This & That
When I got to validate my XHTML, I get warnings saying
character "&" is the first character of a delimiter but occurred as data
What I need to be able to do is convert the ampersand character to &
Here is the code which I thought would work but it doesn't
while($row=mysql_fetch_array($result)){
$rawstring = strtoupper($row['title']);
$title = str_replace('&', '&', $rawstring);
if (!$row['photo']){
echo "<div id=\"right\"><h3>".$title."</h3><p style=\"text-align:left\"><i>Date added: ".$row['date']."</i></p><p class=\"style3\">".nl2br($row['content'])."</p><br /></div>\n";
} else {
echo "<div id=\"right\"><h3>".$title."</h3><p style=\"text-align:left\"><i>Date added: ".$row['date']."</i></p><p><img src=\"/images/large/".$row['photo']." class=\"right\"\">".nl2br($row['content'])."</p><br /></div>\n";
}
}