Hi,
I would like to simply replace all the emotion text from my database such as : ) and have them replaced with the image ? .
If someone could post a simply change to my code this would help me heeps as I have been looking for one the net for days now,
I simply want the database Field “message” to have the code where all info within that field of the database goes through a filter and finds all the emotions and replaces with images like this forum?,
this is the field code where it is displayed: <? echo $rows[‘message’]; ?>
[code=php]
<?php
// Connect to server and select database.
mysql_connect(“$host”, “$username”, “$password”)or die(“cannot connect”);
mysql_select_db(“$db_name”)or die(“cannot select DB”);
$rowsPerPage = 20;
$pageNum = 1;
if(isset($_GET[‘page’]))
{
$pageNum = $_GET[‘page’];
}
$offset = ($pageNum – 1) * $rowsPerPage;
$sql=”SELECT * FROM $tbl_name ORDER BY id DESC LIMIT $offset, $rowsPerPage”;
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
?>
<table width=”500″ border=”0″ cellspacing=”0″ cellpadding=”0″>
<tr>
<td width=”73″><font color=”#FF0000″ size=”1″ face=”Times New Roman, Times, serif”><? echo $rows[‘datetime’]; ?>
-</font></td>
<td colspan=”2″> <font color=”#0000CC” size=”3″ face=”Times New Roman, Times, serif”><? echo $rows[‘TippingName’]; ?></font></td>
</tr>
<tr>
<td colspan=”2″ align=”center” valign=”top”><font size=”2″ face=”Times New Roman, Times, serif”>Message:</font></td>
<td width=”426″ align=”left” valign=”top”><font color=”#000000″ size=”2″ face=”Times New Roman, Times, serif”>
[B]<? echo $rows[‘message’]; ?>[/B]</font></td>
</tr>
</table>
<div align=”center”></div>
<hr align=”center” width=”450″ size=”1″ color=”#999999″>
<center><font color=”#000000″ size=”2″><?
}
$query = “SELECT COUNT(id) AS numrows FROM $tbl_name”;
$result = mysql_query($query) or die(‘Error, query failed’);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row[‘numrows’];
$maxPage = ceil($numrows/$rowsPerPage);
$self = $_SERVER[‘PHP_SELF’];
if ($pageNum > 1)
{
$page = $pageNum – 1;
$prev = ” <a href=”$self?affc=msgboard&page=$page”><font color=#FF0000>[«]</font></a> “;
$first = ” <a href=”$self?affc=msgboard&page=1″><font color=#FF0000>[««]</font></a> “;
}
else
{
$prev = ‘ [«] ‘;
$first = ‘ [««] ‘;
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = ” <a href=”$self?affc=msgboard&page=$page”><font color=#FF0000>[»]</font></a> “;
$last = ” <a href=”$self?affc=msgboard&page=$maxPage”><font color=#FF0000>[»»]</font></a> “;
}
else
{
$next = ‘ [»] ‘;
$last = ‘ [»»] ‘;
}
echo “$first”. $prev . ” Page <strong>$pageNum</strong> of <strong>$maxPage</strong> ” . $next . $last;
mysql_close();
?>