azisnomarsa Posted June 17, 2007 Share Posted June 17, 2007 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 More sharing options...
wildteen88 Posted June 17, 2007 Share Posted June 17, 2007 where does the $zinja variable come from? I do not see that variable any where in your code. Link to comment https://forums.phpfreaks.com/topic/55933-solved-smilies-with-str_replace/#findComment-276230 Share on other sites More sharing options...
azisnomarsa Posted June 17, 2007 Author Share Posted June 17, 2007 Well as I understood from tuts I make variable with str_replace and then I just print it. Link to comment https://forums.phpfreaks.com/topic/55933-solved-smilies-with-str_replace/#findComment-276233 Share on other sites More sharing options...
wildteen88 Posted June 17, 2007 Share Posted June 17, 2007 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 https://forums.phpfreaks.com/topic/55933-solved-smilies-with-str_replace/#findComment-276283 Share on other sites More sharing options...
GingerRobot Posted June 17, 2007 Share Posted June 17, 2007 Im going to guess that maybe it should be: $zinja = str_replace( "", "<img src='/bildes/smile.gif'>,", $rrr['zinja'] ); Link to comment https://forums.phpfreaks.com/topic/55933-solved-smilies-with-str_replace/#findComment-276287 Share on other sites More sharing options...
azisnomarsa Posted June 17, 2007 Author Share Posted June 17, 2007 Thank you it woked. Now I understand my mistake. Just great Link to comment https://forums.phpfreaks.com/topic/55933-solved-smilies-with-str_replace/#findComment-276289 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.