php echo html tag as text

Asked

Viewed 2,421 times

2

I have a query in php/oracle that shows the result in the browser, hides a tag "< /b>" while in oracle sql Developer presents everything ok.

The expected: '___< /b>'

What displays in the browser: '___'

The result in oracle sql:

SELECT REPLACE(REPLACE(REPLACE(REPLACE( "AUXILIARES_ACESSOS_DB", "SOLICITACAO_", ""), "_DB",""), "AUXILIARES_",""), "PRJ_","") DEMANDA, bg.BG_BUG_ID DEFEITO, bg.BG_STATUS STATUS, bg.BG_USER_TEMPLATE_09 SIR_ENCAMINHADA_PARA, bg.BG_USER_TEMPLATE_03 SISTEMA, bg.BG_USER_TEMPLATE_01 NATUREZA_ERRO, bg.BG_USER_TEMPLATE_05 ETAPA_TESTE, remove_html_tags(final_substr(bg.BG_DEV_COMMENTS,"___</b>")) COMENTARIO FROM AUXILIARES_ACESSOS_DB.BUG bg WHERE bg.BG_STATUS NOT IN ("Pendent (Retest)", "Closed", "Rejected", "Cancelled", "On_Retest") AND bg.BG_USER_TEMPLATE_09 IN ("GA - CSC", "GA-OI", "GA - OI") UNION ALL

The php/oracle query:

$sql = "SELECT TESTE FROM VW_ZEND_BUG";
$result = odbc_exec($conOraSql , $sql);
while ($row = odbc_fetch_array($result)) {
   echo $row["TESTE"], "<br />";
}

The result in the browser by the php/oracle query:

SELECT REPLACE(REPLACE(REPLACE(REPLACE( 'AUXILIARES_ACESSOS_DB', 'SOLICITACAO_', ''), '_DB',''), 'AUXILIARES_',''), 'PRJ_','') DEMANDA, bg.BG_BUG_ID DEFEITO, bg.BG_STATUS STATUS, bg.BG_USER_TEMPLATE_09 SIR_ENCAMINHADA_PARA, bg.BG_USER_TEMPLATE_03 SISTEMA, bg.BG_USER_TEMPLATE_01 NATUREZA_ERRO, bg.BG_USER_TEMPLATE_05 ETAPA_TESTE, remove_html_tags(final_substr(bg.BG_DEV_COMMENTS,'___')) COMENTARIO FROM AUXILIARES_ACESSOS_DB.BUG bg WHERE bg.BG_STATUS NOT IN ('Pendent (Retest)', 'Closed', 'Rejected', 'Cancelled', 'On_Retest') AND bg.BG_USER_TEMPLATE_09 IN ('GA - CSC', 'GA-OI', 'GA - OI') UNION ALL
  • You want to display all the tags of this string?

  • that is the result and yes, all.

1 answer

2


To print php or html code as plain text you can use the function highlight_string.

<?php
$str = '<p><b>texto</b></p>';
highlight_string($str);

The exit of highlight_string() is almost the same as htmlspecialchars(), except for the <code> and <span>.

<?php
$str = htmlspecialchars('<p><b>texto</b></p>');
echo $str;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.