php - Counting rows with conditions? -


before has been answered before, have tried everything, literally.

i trying count number of rows in mysqli query 2 clauses.

if (isset($_post['member_name']) , isset($_post['memeber_password'])) {     $member_name_input = mysqli_real_escape_string($query, $_post['member_name']);     $member_password_input = mysqli_real_escape_string($query, $_post['member_password']);      $result = mysqli_query($query, "select count(*) member_count `members` `member_name` = '$member_name_input' , `member_password` = '$member_password_input'") or die(mysqli_error($query));     $counter = $row['member_count'];      if ($counter = 1) {         $result = mysqli_query($query, "select * `members` `member_name`='$member_name_input' , `member_password`='$member_password_input'") or die(mysqli_error($query));         $row = mysqli_fetch_array($result);         $member_suspended = $row['member_suspended'];         $member_validation = $row['member_validation'];     }      if ($member_suspended < time() , $member_validation = 2) {         $_session['member_id'] = $row['member_id'];         echo $counter;     } elseif ($member_suspended >= time()) {         $suspension_date = date('d. m. y.', $member_suspended);         echo '<div class="left_container"><h3>you suspended until '.$suspension_date.'.</h3></div>';     } elseif ($member_validation = 1) {         echo '<div class="left_container"><h3>your account has not been confirmed, yet.</h3></div>';     } else {         echo '<div class="left_container"><h3>login unsuccessful.</h3></div>';     } }  

my problem when try logging in invalid password and/or username (the combination doesn't exists in table), $counter still 1 , fulfills requirements first if statement.

i have tried counting rows in many ways, none of worked.

some of other attempts were:

$counter = 0; while ($row = mysqli_fetch_array($result)) { ++$counter; } 

and

$counter = mysqli_num_rows($result); 

i'm trying come way log users in successfully, , show error messages invalid login attempts.

thank taking time read through , try help. :)

if ($counter = 1) { 

this = 1, presume mean

if ($counter == 1) { 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -