Hi,
I would like the first letter in a string I retrieve from an mySQL database to be converted into a graphic (an ornamental rendering of the same letter).
E.g. a text such as:
Somewhere in the Middle East.
Would automatically turn into:
<img src="pictures/s.jpg" alt="S">omewhere in the Middle East.
The following is the code I am currently using on a dynamic PHP webpage. The code at the mo just retrieves a text from a database, formats the text and then echoes it:
$goatswiththe=$_GET['goatswiththe'];
mysql_connect("server","user","password") or die(mysql_error());
mysql_select_db("goatswi_db") or die(mysql_error());
$result = mysql_query("SELECT * FROM goattext_eng") or die(mysql_error());
$row = mysql_fetch_array( $result );$goattext = $row[$goatswiththe];
function nl2p($goatfunction)
{
$goatfunction = str_replace("\r\n\r\n", "</p><p class='english'>", $goatfunction);
$goatfunction = str_replace("\r\n", "<br>", $goatfunction);
$goatfunction = str_replace("</p><p class='english'>", "</p>\n<p class='english'>", $goatfunction);
$goatfunction = str_replace("\r", '', $goatfunction);
$goatfunction = str_replace("<p class='english'></p>", '', $goatfunction);
return $goatfunction;
}
$fomattedtext = nl2p($goattext);
echo "$fomattedtext"
ANY IDEAS?
Many, many thanks,
Leao