mysql num_row check for multiple post values

hammadkhan

New Member
I need to perform num_row check for multiple input fields, to check if all fields have emails which are in the database. and if one field is not in the database it should echo that that value is not a registered email.also if the field is empty it ignores it unless all fields are empty in which case it echos a message. what I have made is flawed, as it doesn't works if the first input field is empty. is there a better way to to this?\[code\]foreach($_POST as $value){ $usercheck = "SELECT email FROM users WHERE email = '$value'"; $usercheck = $db->query($usercheck); if($usercheck->num_rows !== 0 || $value http://stackoverflow.com/questions/14543878/=="") { $valid="1"; } break; } if(empty($value)) { echo "none filled in"; } else if ($valid == "1"){ echo "all good";} else{ echo $value." is not a user";}\[/code\]
 
Back
Top