Jump to content

Need help functions


dynamicgfx

Recommended Posts

Need help with the code below it gives a fatal error

 

<? $result = mysql_query("SELECT * FROM topics WHERE id='$id'");

while($row = mysql_fetch_array($result))
  { 
  $des = $row['desc'];
		?>
            <?
		function replacesmiley($des)
{
         $des = str_replace('', '<img src="set1/biggrin.gif" alt="" />', $des);
         $des = str_replace('', '<img src="set1/biggrin.gif" alt="" />', $des);
         $des = str_replace('', '<img src="set1/sad.gif" alt="" />', $des);
	 $des = str_replace('', '<img src="set1/001_smile.gif" alt="" />', $des);
         $des = str_replace('', '<img src="set1/tongue_smilie.gif" alt="" />', $des);
         $des = str_replace('', '<img src="set1/tongue_smilie.gif" alt="" />', $des);
         return $des;
} ?>
<table width="100%" border="1" cellpadding="0" cellspacing="0" style="border:thin; border-top:none;">
  <tr style="color:#FFF;">
    <th width="30%" bgcolor="#000000" scope="col"></th>
    <th width="70%" bgcolor="#000000" scope="col"><? echo $row['name']; ?></th>
  </tr>
    <tr height="50px" style="text-align:center; background:url(http://k-rs.co.uk/images/background.png);">
    <td><? echo $row['user']; ?><br /><? echo $row['post']; ?></td>
    <td><? echo replacesmiley($des) ?></td>
  </tr>
  <? $server = mysql_query("SELECT * FROM reply WHERE topic='$id'");

while($rows = mysql_fetch_array($server)) { 
$user = $rows['user'];
$desc = $rows['desc']; ?>
            <?
		function replace($desc)
{
         $desc = str_replace('', '<img src="set1/biggrin.gif" alt="" />', $desc);
         $desc = str_replace('', '<img src="set1/sad.gif" alt="" />', $desc);
	 $desc = str_replace('', '<img src="set1/001_smile.gif" alt="" />', $desc);
         $desc = str_replace('', '<img src="set1/tongue_smilie.gif" alt="" />', $desc);
         return $desc;
} ?>
  </tr>
    <tr height="50px" style="text-align:center; background:url(http://k-rs.co.uk/images/background.png);">
    <td><? echo $rows['user']; ?><br /><? echo $rows['rank']; ?><br />Posted at: <? echo $rows['post']; ?></td>
    <td><? echo replace($desc) ?></td>
  </tr>
<? }} ?>

Link to comment
https://forums.phpfreaks.com/topic/263871-need-help-functions/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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