title: How do I count rows with matching id?
body: <p>I'm currently having some difficulty with determining if any rows match a specific user id. The code runs fine, but the if statement (if($notifs !== false) always returns true and hence "No notifications found" never displays. How do I write the statement to only check for "receive_id" that match the current session id?</p>
  
  <pre><code>$user_id = $_SESSION['userID'];
  
  if(isset($_POST["view"]))
  {
  
  $stmt = $user_notif-&gt;runQuery("SELECT * FROM tbl_users WHERE userID=:uid");
  $stmt-&gt;execute(array(":uid"=&gt;$user_id));
  $row = $stmt-&gt;fetch(PDO::FETCH_ASSOC);
  
  $stmt = $user_notif-&gt;runQuery("SELECT * FROM notif_follow WHERE receive_id= ? ORDER BY id DESC LIMIT 5");
  $stmt-&gt;bindValue(1,$user_id);
  $stmt-&gt;execute();
  $notifs = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
  
  $notification = '';
  
  if($notifs !== false)
   {
    foreach($notifs as $notif)
    {
  
    $send_id = $notif['send_id'];
  
    $query2 = $user_notif-&gt;runQuery("SELECT id FROM following WHERE user1_id=:uid1 AND user2_id=:uid2");
    $query2-&gt;execute(array(":uid1"=&gt;$user_id,":uid2"=&gt;$send_id));
    $query2result = $query2-&gt;fetch(PDO::FETCH_ASSOC);
  
    if($query2result !== false){
    $follow .= '&lt;a href="followoff.php?id='.$send_id.'"&gt;&lt;button class="button"&gt;Remove Channel&lt;/button&gt;&lt;/a&gt;';
    }
    else{
    $follow .= '&lt;a href="followon.php?id='.$send_id.'"&gt;&lt;button class="button"&gt;Add Channel&lt;/button&gt;&lt;/a&gt;';
    }
  
    $notification .= '
     &lt;li&gt;
       &lt;div class="notifbox"&gt;
       &lt;strong style="color: #4b8ed3;"&gt;'.$notif["send_name"].'&lt;/strong&gt;&lt;p style="color: #fff;"&gt; has added you.&lt;/p&gt;
  
       '.$follow.'
  
  &amp;nbsp&lt;a href="index.php?id='.$notif["send_id"].'"&gt;&lt;button class="button"&gt;View Channel&lt;/button&gt;&lt;/a&gt;
       &lt;/div&gt;
     &lt;/li&gt;
     &lt;div class="sectionheader3"&gt;&lt;/div&gt;
     ';
  
    }
   }
   else
   {
    $notification .= '&lt;li&gt;&lt;h2 style="color: #4b8ed3; padding: 10px;"&gt;No Notifications Found&lt;h2&gt;&lt;/li&gt;';
   }
  </code></pre>