I need to compare domain submitted and processed by a form through $_POST
with database domains because I can only insert an email from each domain in the database. For this first I got the email from $_POST
and then stored all the emails from the database in an array with mysql_fetch_array
in the database. Now I need to make this array
return only the domains as I did with explode which resulted in the $tmpdominio
variable and then compare these two information to see if the domain already exists in the database. As I'm starting, so far I have this code.
# Pegando o dominio deste email
$emaildoform = $_POST['email'];
$tmpdominio = explode('@', $emaildoform);
# Pegando todos os emails da minha tabela
$dados = mysql_query("SELECT email FROM wp_agencias");
while($arraydeemails = mysql_fetch_array($dados)){
# Eu preciso extrair o domínio de cada e-mail do array ...
# ... depois vou comparar com $tmpdominio para ...
# ...verificar se dominio está presente na base
};