Ho provato così, e con altri tentativi, ma non riesco proprio!! Vi chiedo aiuto Grazie!!
Codice PHP:
$sql "SELECT * FROM emotion";
$res mysql_query($sql$myconn) or die('Errore...sql');
$num mysql_num_rows($res);

    for(
$x=0$x<$num$x++)

        {

            
$row mysql_fetch_row($res);
            
$tag_e $row[1];
            
$url_e $row[2];

            echo
"$commento_cot = str_replace(\"$tag_e\", \"[img]$url_e[/img]\", $commento_cot);
        
        }