Tema: Emails
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/08/2013, 00:50
jhenpaz
 
Fecha de Ingreso: mayo-2013
Mensajes: 9
Antigüedad: 10 años, 11 meses
Puntos: 0
Mensaje Emails

Hola foros del web, espero y me puedan ayudar con un problema que tengo; estoy haciendo un forlumario de logeo cuando me quiero registrar primero verifico si el usuario existe y sino inserto los datos, bueno mi problema es que cuando hago este query para saber si el usuario existe:

public function __verificarUser()
{
$link = Conectarse();
$query = "select * from usuario where nombres = $this->nombre and apellidos = $this->apellidos and email = $this->email";
$result = mysql_query($query,$link) or die(mysql_error($link));
while($row = mysql_fetch_array($result))
{
$this->id_user = $row[0];
$this->nombre = $row[1];
$this->apellidos = $row[2];
$this->email = utf8_encode($row[3]);
$this->password = $row[4];
$this->fecha_nacimiento = $row[5];
$this->sexo = $row[6];
$this->estado = $row[7];
$this->fecha_creacion = $row[8];
}
return $result;
}

Al momento de sacarme el campo de email de la BD me sale este error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@hotmail.com' at line 1

Ya probe usando utf8 y esto: mysql_query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'", $link); y mi tabla tiene el cotejamiento utf8_general y nada que puedo solucionarlo; quizas me faltaria alguna configuracion en el wampserver...!!



Asi es como ejecuto la funcion:

$usuario = new User;
$usuario->nombre = $_POST["nombres"];
$usuario->apellidos = $_POST["apellidos"];
$usuario->email = $_POST["email"];
$usuario->password = $_POST["password"];
$usuario->fecha_nacimiento = $_POST["fecha_nac"];
$usuario->sexo = $_POST["sexo"];

$result = $usuario->__verificarUser();



Espero y me puedan ayudar...!!!! gracias