Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/06/2016, 01:09
MrEnfurecido
 
Fecha de Ingreso: abril-2016
Mensajes: 15
Antigüedad: 8 años
Puntos: 0
On duplicate key update

Buenas, yo puedo hacer esto:

//creating an sql query
$sql = "INSERT INTO users (token,email) VALUES ('$token','$email')"
." ON DUPLICATE KEY UPDATE token = '$token';"
." ON DUPLICATE KEY UPDATE email = '$email';";

Tengo tanto como token y email como unicas y quiero que no se repitan al hacer un insert...se hace asi?