match a form value against all values in database
<p>so my studies have led me to this little problem. (ive been into php for a solid month so i apologize if im not entirely clear)</p>

<p>i have a small form consisting of user name and pass.</p>

<pre><code>    &lt;form method="post" action="proc.php"&gt;
      &lt;table&gt;
        &lt;tr&gt;
            &lt;td&gt;Username:&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="user" id="user"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;password:&lt;/td&gt;
            &lt;td&gt;&lt;input type="text" name="password" id="password"&gt;&lt;/td&gt;
        &lt;/tr&gt;
            &lt;tr&gt;
            &lt;td&gt;&lt;/td&gt;
            &lt;td&gt;&lt;input type="submit" value="submit"&gt;&lt;/td&gt;

        &lt;/tr&gt;

&lt;/table&gt;
&lt;/form&gt;
</code></pre>

<p>and i have the corresponding values in the db columns.</p>

<p>what im trying to do is, im trying to check the entered name in the form fields against the desired values of the databases columns.</p>

<p>so when i do this to test for just one value in the db(the first value sine its not looping), it works and lets me in:</p>

<pre><code>$dbq = "SELECT * FROM accounts;";
    $dbqDoIt = mysqli_query($connect2db, $dbq)or die("error".mysqli_error($connect2db));

    $getNames = mysqli_fetch_array($dbqDoIt);


    //check if user acc. exists inside vSpot database.
    if(($name !== $getNames['username']) || ($pass !== $getNames['password'])){
        header("Location:index.php"); /* Redirect browser */
</code></pre>

<p>for testing my while loop...(cause im new lol), when i do this:</p>

<pre><code>$nums = array(1,2,3,4,5);

for($i=0; $i&lt;6; $i++){
    if($nums[0] &lt; 6 ) echo $i . '&lt;br/&gt;';
}
</code></pre>

<p>it works and lists numbers 1-5.</p>

<p>now when i try to loop through db for names/pass, it doesnt work.
like so:</p>

<pre><code>while($getNames = mysqli_fetch_array($dbqDoIt)){
    //check if user acc. exists inside my  database.
    if(($name !== $getNames['username']) || ($pass !== $getNames['password'])){
        header("Location:index.php"); /* Redirect them to log in */

        }

    } 
</code></pre>

<p>any ideas as to why its not checking against all the values? im sure im missing something lol.</p>

<p>any tips, advice etc ill gladly appreciate.
thank you in advace</p>

<p>somdow.</p>
