Jump to content

strtr using mysql_fetch_array


maxudaskin

Recommended Posts

I have a database with all of my smilies for my forum, and I was wondering why it did this...

upl6446614026.jpg

Database

 

upl3825429063.jpg

Error...

 

The real post is This is some sample text inserted under OOM0100 Michael Bonanno's name. (second post)

	  $topicid       = $_GET['t'];
  $namesql       = mysql_query("SELECT * FROM forum_posts WHERE topicid = '{$topicid}'");
  $postsql       = mysql_query("SELECT * FROM forum_posts WHERE topicid = '{$topicid}'");
  $smilies_query = mysql_query("SELECT * FROM smilies");
  $smilies_array = mysql_fetch_array($smilies_query);
  while($namerow = mysql_fetch_array($namesql)){
  define('name',$namerow['title']);
  }
  ?>
  <table style="border-top:1px #FFFFFF solid" width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="20" colspan="2" bgcolor="#333355"><span class="style26"> <?php echo constant('name'); ?></span></td>
        </tr>
	<?php
	while($posts = mysql_fetch_array($postsql)){
	?>
        <tr>
          <td width="17%" rowspan="3" valign="top" nowrap="nowrap" bgcolor="#EFF4FB"  style="border-bottom:1px #333355 solid; border-right: 1px #333355 solid; padding-left:5px;"><br />
            OOM<?php echo $posts['pid']; ?><br />
            <?php echo $posts['name']; ?><br />
            <br />
            --- Hours<br />
            [php Rank]<br />
            [php Position]<br />
            <br />              
            <br />            </td>
          <td width="83%" height="15" valign="top" bgcolor="#F6F6F6" style="padding-left:5px">
	  <?php
	  echo '<em>Posted on '.$posts['date'].' at '. $posts['time'] .'</em>';
	  ?></td>
        </tr>
        <tr>
          <td valign="top" style="padding-left:5px; padding-top:3px;" bgcolor="#FFFFFF"><?php echo strtr($posts['text'],$smilies_array); $smilies_array; ?></td>
        </tr>
        <tr>
          <td height="39" bgcolor="#FFFFFF" style="border-bottom:1px #333355 solid; padding-left:5px;">Signature </td>
        </tr>
	<?php } ?>
      </table>	

 

 

I made it echo the implode of the array and this is what is said: ../comm/smilies/smile.gif../comm/smilies/smile.gif[smile][smile]:):)

Link to comment
https://forums.phpfreaks.com/topic/94841-strtr-using-mysql_fetch_array/
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.