Thread: replacing...
View Single Post
  #7 (permalink)  
Old 04-19-06, 02:51 AM
qie's Avatar
qie qie is offline
Newbie Coder
 
Join Date: May 2005
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
thanks.... :)

hi, thanks friends......
it's works....
i've modified ....

thanks to nico_swd for:
Quote:
str_replace(array_keys($smilies), array_values($smilies), $data[3]);
thanks to Wuiqed for:
Quote:
//notice that I changed your mysql_num_rows() to mysql_fetch_array()
//this is because mysql_num_rows() only returns HOW MANY rows was
//fetched but doesn't return the actual rows
now the script like below:

PHP Code:

@mysql_pconnect('localhost','root','root');
@
mysql_select_db('database');

$smilies = array(
    
':)' => '<img src="images/smile.gif" />'
    
':(' => '<img src="images/sad.gif" />'
    
';)' => '<img src="images/wink.gif" />'
);

$query mysql_query("SELECT * FROM table");
while(
$data mysql_fetch_array($query)) {
    
$view.= "name: ".$data[1]."<br />";
    
$view.= "subject: ".$data[2]."<br />";
    
    
//;
    
$view.= "message: ".str_replace(array_keys($smilies), array_values($smilies), $data[3])."<hr />";
}

echo 
$view

Last edited by qie; 04-19-06 at 02:53 AM.
Reply With Quote