Jump to content

[SOLVED] smilies with str_replace


azisnomarsa

Recommended Posts

Techincally I have been staring at this coe fpr about 30 mins now, but I cant get where am I wrong,, I mean, image exists and all, but output still is without images :(.

 

 

<?php
$omg = mysql_connect('localhost', '', '');
if (!omg)
{
die(' ' . mysql_error());
}
mysql_select_db("blogging", $omg);
$wii = mysql_query("SELECT * FROM ftw");

while($rrr = mysql_fetch_array($wii))
{
$zinja = str_replace( "", "<img src='/bildes/smile.gif'>,", $zinja );
echo "$zinja";
$amen = strip_tags($rrr['avtor']);
$buda = strip_tags($rrr['mudak']); 	
echo $amen;
echo "<br>";
echo $buda;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/55933-solved-smilies-with-str_replace/
Share on other sites

Yes you can create a var to store what str_replace will return. But you got to pass it a source to do replacements with.

$zinja = str_replace( ":)", "<img src='/bildes/smile.gif'>,", $zinja );

Everything highlighted above is correct. Except for the highlighted variable in red. That variable must contain the raw data that contains the raw smiley symbols for str_replace to replace it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.