Page 1 of 1

help with smilies

Posted: Thu Oct 06, 2005 12:07 pm
by Smackie
Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


My friend asked me to add some smilies in his comment box and well for some reason everything coming out in text and not in smilies i am not getting any errors but can someone help me please

Code: Select all

<?php
include 'db.php';

$comment = mysql_query("SELECT * FROM comment WHERE filter = 'pic1' ORDER BY date DESC");
while ($row = mysql_fetch_array($comment)) {
	$username = $row['username'];
	$message = $row['message'];
	echo "<font color='FF9AFF'><center><b>$username</b>: $message</font></center><br>";

}

if ( isset ( $_POST['message'] ) )
{
	
	$name = addslashes($_POST['username']);
	$message =  $_POST['message'];
	
	if ( ( isset($username) ) && ( isset($message) ) )
	{
  
// getting smilie list
$smilies = mysql_query("SELECT * FROM smilies") or die(mysql_error());
while($get = mysql_fetch_array ($smilies))
{

$alt = $get['Alt'];
$smilie = $get['URL'];

$message = str_replace( $get['Symbol'] , '<img src="smilies/'.$smilie.'" border="0" width="15" height="15" alt="'.$alt.'">' , $message);
$themessage = addslashes($message);

// replacing all smilies
}
}
}
	?>
	<center><form action="insert.php" METHOD="post"> 
<br><br><br><font color="FF9AFF">Name:</font><br>
<input type="input" name="username" size="30" value="" class="input-box"><br>
<font color="FF9AFF">Message:</font><br> 
<input type="input" name="message" size="30" value="" class="input-box"><br>
<input name="filter" type="hidden" value="pic1">
<p><input type="submit" name="submit" value="Submit"> 
</form>
</center>

Thank you
Smackie


Jcart | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Thu Oct 06, 2005 12:38 pm
by John Cartwright
You've been around long enough to know to use

Code: Select all

tags smackie...

Posted: Thu Oct 06, 2005 3:38 pm
by Smackie
Sorry :? i didnt double check on what i was doing i was in a hurry i had some stuff i had to get done asap :?

Posted: Thu Oct 06, 2005 3:44 pm
by Nathaniel
I'd set error reporting to E_ALL and look for undefined variable notices.