Hey everyone,
I've made a replace smiley script, de code for the smiley and the url where the smiley is saved are store in mine mysql database.
If I want replace one smiley goes everything OK, but if I want more than replace one smiley than have I trouble...
For exemple I've 5 different smileys stored in my database,
than will be only one smiley replaced,
exemple:
I've the following smileys:
smile1
smile2
smile3
smile4
smile5
and than will only smile5 will replaced, so than I see a smile and by the others only the code (only smile1/smile2......)
my code:
<?php
echo "Sometext";
$selectsmile = "SELECT * FROM smiles";
$querysmile = mysql_query($selectsmile);
while ($smile = mysql_fetch_object($querysmile))
{
$smilecode = $smile->code;
$smileurl = $smile->url;
$bericht = str_replace("$smilecode", "<img src=$smileurl border=0>","$nieuwsbericht");
}
echo "<font face=\"verdana\" size=\"2\" color=\"#FFFFFF\">$bericht</font>";
echo "onder";
?>
If I place echo $bericht in the while loop, than I see (for exemple If i had 5 smileys in my database stored smile1,smile2,smile3,smile4,smile5) 5 the same messages and in every message will be replaced one smile (the same smile) and not in one message every smile..
exemple:
I've the smiles:
smile1
smile2
smile3
smile4
smile5
Than I will see 5 the same messages and in the first message are all the smile1 replaced and not the other one so I see than the code for that smiley etc.
who can help me?
Many thanks if you want help me!
Greetz,
Edwin