Created
April 19, 2013 01:51
-
-
Save typhonius/5417569 to your computer and use it in GitHub Desktop.
when retrieving a list of users from elsewhere with emails as a shared field this will detect if they exist in the db already
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$emails = array( | |
// fill in emails here or use array from somewhere else | |
); | |
foreach ($emails as $mail) { | |
$query = "SELECT 1 FROM {users} WHERE mail = :mail"; | |
$exists = db_query_range($query, 0, 1, array(':mail' => $mail))->fetchField(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment