Issue with getting values from MySQL databse using array
<p>Hey guys so I am trying to get values from a database based on an array of firstname's, lastnames's and email's.</p>

<p>Here is the code:</p>

<pre><code>$sesfirst = $_SESSION['CSVRfirstnames'];
$seslast = $_SESSION['CSVRlastnames'];
$sesemail = $_SESSION['CSVRemails'];
$Activeusername = $_SESSION['myusername'];
$j = 0;
$i = 0;
$k = 0;

unset($_SESSION['CSVRfirstnames'], $_SESSION['CSVRlastnames'], $_SESSION['CSVRemails']);

   for ($k; $k &lt; count($sesfirst); $k++)
{
                            $sql = "SELECT firstname, lastname, email,username,status FROM csvdata WHERE memberview =:username AND firstname =:sesfirst AND lastname =:seslast AND email = :sesemail ORDER BY lastname";
                            $sth= $DBH-&gt;prepare($sql);
                            $sth-&gt;execute(array(':username' =&gt; $Activeusername,':sesfirst' =&gt; $sesfirst[$k],':seslast' =&gt; $seslast[$k],':sesemail' =&gt; $sesemail[$k]));

                            while ($row = $sth-&gt;fetch(PDO::FETCH_ASSOC)) {
                                $csvfirst = $row;
                                $csvfirstname = $csvfirst['firstname'];
                                $csvlastname = $csvfirst['lastname'];
                                $csvemail = $csvfirst['email'];
                                $csvstatus = $csvfirst['status'];


                                if ($csvstatus != "Non-Active - No Longer Employed"){
                                $Rusernames[$k] = $csvfirst['username'];
                                $i++;
                                echo "
                                        &lt;tr&gt; 
                                    &lt;td&gt;
                                    $csvfirstname
                                    &lt;/td&gt;
                                    &lt;td&gt;
                                    $csvlastname
                                    &lt;/td&gt;
                                    &lt;td&gt;
                                    $csvemail
                                    &lt;/td&gt;
                                    &lt;td&gt;
                                    $i
                                    &lt;/td&gt;

                                  &lt;/tr&gt;

                                ";
                             } 
                            }


}
$_SESSION['rusernames'] = $Rusernames;
</code></pre>

<p>so When I run this, for some reason some of the values that are in the database will come up if one of the words match either the firstname lastname and email.  I need it to show up if only the firstname lastname and email match</p>
