kronow Posted April 10, 2007 Posted April 10, 2007 i am having trouble with my arrays not worknig :S in the annocements script im trying to implant smiles and make it so in line brakes went enter (return w.e) is pressed. CODE if($_POST['topic'] and $_POST['annoucement'] and $_POST['discussion']) { $codes = array(":)", ";)", ":o",":O", ":d",":D", ":s", ":S", ":(", ":red", ":clown", ":bashful", ":x", ":green", ":|", ";(", ":]", ":horny", ":cool"); $images = array("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); $msg=str_replace(array("\n"),array(" "),strip_tags($_POST['annoucement'])); $newmsg = str_replace($codes, $images, $msg); if($_POST['discussion'] == "Y") { $diss_on=1; } else { $diss_on=0; } $time=time(); mysql_query("INSERT INTO `annoucements` (`id`, `topic`, `annoucement`, `from`, `time`, `views`, `discussion`) VALUES ('NULL', '$_POST[topic]', '$newmsg', '$ir[userid]', '$time', '0', '$diss_on');"); mysql_query("UPDATE `users` SET `new_annoucement` = `new_annoucement` + '1' WHERE `userid` = '$ir[userid]'"); print "Annoucement Posted! [url='ann.php']Back[/url]"; and a test annocements comes with like this tsetsetset br /> br />sdfagsdfgsdfg br /> br />img src=/smilies/smiley1.gif> img src=/smilies/smiley16.gif> br /> br /> br />asdasdasd br /> br />hahaha can you help please? Cheers :mrgreen: Quote
vinyl Posted April 11, 2007 Posted April 11, 2007 Re: Help Please (Take 2) Your implementation of Spellbyte's smilies lives on in yet another form. --and it appears correct. Your problem is likely in the display, (ann.php) find this about 15-20 lines from the bottom: print "[b]Views[/b] : ".number_format($r['views'])." [b]Date Posted[/b] : ".date("F j, Y",$r['time'])." </td><td>$r[topic]</td><td><font size=-1>".str_replace('<', '', $r['annoucement'])."</font></td><td>"; replace it with: print "[b]Views[/b] : ".number_format($r['views'])." [b]Date Posted[/b] : ".date("F j, Y",$r['time'])." </td><td>{$r[topic]}</td><td><font size=-1>{$r['annoucement']}</font></td><td>"; the string_replace '<' being the real killer here for ya. Quote
kronow Posted April 12, 2007 Author Posted April 12, 2007 Re: Help Please (Take 2) oo thanks for this works like a charmer :) +1 for great support :mrgreen: Quote
spellbyte ® Posted May 4, 2007 Posted May 4, 2007 Re: Help Please (Take 2) glad to see something of mine being used elsewhere :) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.