Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/11/2011, 11:08
MoebiusDigital
 
Fecha de Ingreso: junio-2007
Ubicación: Buenos Aires, Argentina
Mensajes: 262
Antigüedad: 16 años, 11 meses
Puntos: 1
Respuesta: es posible hacer esto

Para eso hacen falta tres pasos:

1. Consultar si existe
2. Si existe, hacer un pdate
3. Si no existe, hacer un insert

En PHP sería algo así:

Código PHP:
Ver original
  1. $user = $_POST['user'];
  2. $fondo = $_POST['fondo'];
  3. $sql = mysql_query("select count(*) as total from disney where user = '$user');
  4. $row = @mysql_fetch_array($sql);
  5. if ($row['total'] > 0){ // el usuario ya existe
  6. // SENTENCIA DE ACTUALIZACIÓN
  7. } else { // el usuario no existe
  8. // SENTENCIA DE INSERCIÓN
  9. }

Saludos!
Pablo
__________________
Moebius Digital | La pieza que faltaba
Diseño web | Web hosting