Simple activation script The script is fully working, but I ask is there a better way I can do this rather than name all of the query variables, $q, $q1 etc, and then use if else statements to execute the code.

&lt;?php 
// open the mysql connection

require_once('mysqli.php');

// successful login variables

$q = $dbc -&gt; prepare("SELECT * FROM accounts WHERE email = ? &amp;&amp; password = ? &amp;&amp; logcount != ''");
$q -&gt; bind_param('ss', ($_POST['email']), ($_POST['password'])); 
$q -&gt; execute();
$q -&gt; store_result();

// wrong password variables

$q1 = $dbc -&gt; prepare("SELECT * FROM accounts WHERE email = ? &amp;&amp; password != ? &amp;&amp; logcount != ''");
$q1 -&gt; bind_param('ss', ($_POST['email']), ($_POST['password']));
$q1 -&gt; execute();
$q1 -&gt; store_result();  

// not active variables

$q2 = $dbc -&gt; prepare("SELECT * FROM accounts WHERE email = ? &amp;&amp; logcount = ''");
$q2 -&gt; bind_param('s', ($_POST['email']));
$q2 -&gt; execute();
$q2 -&gt; store_result();  

// successful login query

if ($q -&gt; num_rows == 1) {
    $q = $dbc -&gt; prepare("UPDATE accounts SET logcount = logcount+1 WHERE email = ?");
    $q -&gt; bind_param('s', ($_POST['email']));
    $q -&gt; execute();
    $dbc -&gt; close();
    header('location: shack');
    exit();
}

// wrong password query

elseif ($q1 -&gt; num_rows == 1) {
    echo '&lt;p&gt;Your password is incorrect.&lt;/p&gt;';
}

// not activated query

elseif ($q2 -&gt; num_rows == 1) {
    echo '&lt;p&gt;Your account is not activated.&lt;/p&gt;';
}

// blank email form entry

elseif (empty($_POST['email'])) {
    echo '&lt;p&gt;You did not fill in an email on the login form.&lt;/p&gt;';
}

// account not found

else {
    echo '&lt;p&gt;An account could not be found.&lt;/p&gt;';
}

// close the mysql connection

$dbc -&gt; close();

?&gt;
Appears you are storing cleartext passwords and doing a 1:1 comparison.  This is bad.  

You can clean the code up by doing the following and executing 1 query to MySQL:

require_once('mysqli.php');  
// successful login variables  
$q = $dbc -&gt; prepare("SELECT email,dbClearTextPassword,accountActive FROM accounts WHERE email = ?"); 
$q -&gt; bind_param('s', ($_POST['email']));  
$q -&gt; execute(); 
$q -&gt; store_result();

// check to see if you returned any information from your query
if ($q-&gt;num_rows == 0) { 
  // email doesn't exist in db .. #fail
  exit;
}

if ($q['accountActive'] != '1') { 
  // email account is not active .. #fail
  exit;
}

// check the password matches 
if ($_POST['clearTextPassword'] == $q['dbClearTextPassword']) { 
  // do some of your fancy code to process the successful login
} else { 
  // do some other fancy code to process a login failure
}

$dbc-&gt;close();