Skip to content

Instantly share code, notes, and snippets.

@kojiromike
Created November 17, 2013 01:58
Show Gist options
  • Save kojiromike/7508110 to your computer and use it in GitHub Desktop.
Save kojiromike/7508110 to your computer and use it in GitHub Desktop.
<?php
// Variable for keeping track if a user has posted. Set to false initially. If found it will be changed to true.
$alreadyPosted = false;
// Loop through all the posts
foreach ($posts_array as $post) {
// Check to see if the person in the database ($post['name']) matches the supplied name ($name)
if ($post['name'] == $name) {
// It does. Great. Set the variable to true.
$alreadyPosted = true;
break;
}
}?>
<div
<?php
if ($alreadyPosted) {
echo 'id="highlight"';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment