For some reason I cannot get this to work for the life of me, I am new to prepared statements!
$q = $dbc -> prepare ("SELECT * FROM accounts WHERE email = ? && logcount = ''");
$q -> bind_param ('s', ($_SERVER['QUERY_STRING']));
$row = $q -> fetch_array(MYSQLI_ASSOC);
$q -> execute();
$q -> store_result();
if ($q -> num_rows == 1) {
$q = $dbc -> prepare("UPDATE accounts SET logcount = '0' WHERE email = ?");
$q -> bind_param('s', ($_SERVER['QUERY_STRING']));
$q -> execute();
echo 'Congratulations ' . $row['username'] . ' your account is now active!
';
}
Any ideas why $row['username'] will not print? It returns a : Call to undefined method mysqli_stmt::fetch_array()
Thanks.