Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/01/2013, 08:45
jaume_hernandez
 
Fecha de Ingreso: julio-2011
Ubicación: Esplugues
Mensajes: 5
Antigüedad: 12 años, 9 meses
Puntos: 0
MySQL query con variables PHP

Hola a todos,
Seguro que es muy fácil pero me estoy volviendo loco.
Intento validar si un correo electrónico existe en la base de datos, pero siempre devuelve 0 coincidencias.

Por favor, necesito ayuda
El código es:

Código PHP:
<?php
//MySQL Database Connect
mysql_connect("localhost""*******""*********"
 or die(
"Unable to connect to MySQL");

//get data from form 
$email=$_POST['email'];

//Count coincidences on database
$sql "SELECT COUNT(*) FROM pressmails WHERE email='$email'";
$result mysql_query($sql);


//If there are more than 0 coincidences the user is registered 
//otherwise not registered
if($result 0){ 
    echo 
"The user is registered";
} else { 
    echo 
"The user is not registered";


//Close database connection
mysql_close();
?>