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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.