mardi 25 septembre 2018

My if statement is not working as expected

$mtFB = $conn->query("SELECT entry_type FROM bn_publicacao")->fetchColumn();

if ($mtFB['entry_type'] == 'pagina'){ 
  echo '<meta property="og:type" content="website">';
} else{
   echo '<meta property="og:type" content="article">';
   echo '<meta property="article:author" content="">';
   echo '<meta property="article:publisher" content="">';
   echo '<meta property="article:published_time" content="">';
   echo '<meta property="article:modified_time" content="">';
}

The column called entry_type have only two possibles values: "pagina" or "post", this if statement should echo the meta that in into the if when the entry_type = pagina and echo the meta tags that is into the else when the entry_type = post.

But it's only printing out the else statement. Why?

Aucun commentaire:

Enregistrer un commentaire