PHP code is not recognized on the page

0

I made a menu with Ajax and it dynamically changes the contents, so far so good, but the problem is that when I insert a PHP code on the page it does not recognize the code and it shows the writings, it appears this instead of executing the code . Anyone know what's going on ??

Note: before Ajax worked normally.

prepare("SELECT * FROM empresa"); 
$executa = $empresa->execute(); 
if($executa){
  while($reg = $empresa->fetch(PDO::FETCH_OBJ)){ 
  /* Para recuperar um ARRAY utilize PDO::FETCH_ASSOC */ 
?> 
txt_empresa
?> 
getMessage(); 
} 
?>
    
asked by anonymous 20.11.2015 / 04:04

1 answer

3

Always use <?php at the beginning of a PHP code and end with ?> .

For example, in the code you posted above the function that is named getMessage() is not among PHP tags. You have to always check. Avoid using only <? to start PHP code. Some Apaches are not configured to use short_tags .

Also, check the file extension if it is actually .php . Last point to check is whether the apache you are running is an apache or is IIS (windows). Always try to use Apache like Xampp, Wamp, Vertrigo, etc.

    
20.11.2015 / 04:50