$stmt = $conn->query("SELECT DISTINCT(title) as title FROM table WHERE title IS NOT NULL")->fetchAll();
foreach ($stmt as $tag) {
if ($tag['title'] == 'home'){
echo 'tag home';
} elseif ($tag['title'] == 'contact'){
echo 'tag contact';
}
}
My current results are: Array ( [title] => home [0] => home ) tag homeArray ( [title] => contact [0] => contact ) tag contact
on all pages
The desired results:
- When on
home
page :tag home
- When on
contact
page:tag contact
Aucun commentaire:
Enregistrer un commentaire