Ver Mensaje Individual
  #19 (permalink)  
Antiguo 03/03/2005, 16:57
Avatar de swishts
swishts
 
Fecha de Ingreso: noviembre-2002
Ubicación: Uruguay
Mensajes: 209
Antigüedad: 22 años, 2 meses
Puntos: 0
Pago a quien me haga esto...

Hola, como lo dice en todo este tema necesito lo siguiente.

Un php que:

- Entre en una base de datos
- Luego una tabla
- Busque en el campo username los registros duplicados
- Que seleccione de esos repetidos el user_id mas bajo.
- Elimine el resto de los repetidos de manera tal que solo queden los que tienen el id mas bajo sin mas repetidos.

El pago es por Paypal, $20.

En este mismo tema se facilitan muchas cosas, solo faltaria un php que lo haga.

Aqui les dejo la tabla para practicar que funcione correctamente:

Código:
CREATE TABLE `nuke_users` (
 
`user_id` int(11) NOT NULL auto_increment,
 
`name` varchar(60) NOT NULL default '',
 
`username` varchar(25) NOT NULL default '',
 
`user_email` varchar(255) NOT NULL default '',
 
`femail` varchar(255) NOT NULL default '',
 
`user_website` varchar(255) NOT NULL default '',
 
`user_avatar` varchar(255) NOT NULL default '',
 
`user_regdate` int(50) NOT NULL default '0',
 
`user_icq` varchar(15) default NULL,
 
`user_occ` varchar(100) default NULL,
 
`user_from` varchar(100) default NULL,
 
`user_interests` varchar(150) NOT NULL default '',
 
`user_sig` varchar(255) default NULL,
 
`user_viewemail` tinyint(2) default NULL,
 
`user_theme` int(3) default NULL,
 
`user_aim` varchar(18) default NULL,
 
`user_yim` varchar(25) default NULL,
 
`user_msnm` varchar(25) default NULL,
 
`user_password` varchar(40) NOT NULL default '',
 
`storynum` tinyint(4) NOT NULL default '10',
 
`umode` varchar(10) NOT NULL default '',
 
`uorder` tinyint(1) NOT NULL default '0',
 
`thold` tinyint(1) NOT NULL default '0',
 
`noscore` tinyint(1) NOT NULL default '0',
 
`bio` tinytext NOT NULL,
 
`ublockon` tinyint(1) NOT NULL default '0',
 
`ublock` tinytext NOT NULL,
 
`theme` varchar(255) NOT NULL default '',
 
`commentmax` int(11) NOT NULL default '4096',
 
`counter` int(11) NOT NULL default '0',
 
`newsletter` int(1) NOT NULL default '1',
 
`user_posts` int(10) NOT NULL default '0',
 
`user_attachsig` int(2) NOT NULL default '0',
 
`user_rank` int(10) NOT NULL default '0',
 
`user_level` int(10) NOT NULL default '1',
 
`broadcast` tinyint(1) NOT NULL default '1',
 
`popmeson` tinyint(1) NOT NULL default '0',
 
`user_active` tinyint(1) default '1',
 
`user_session_time` int(11) NOT NULL default '0',
 
`user_session_page` smallint(5) NOT NULL default '0',
 
`user_lastvisit` int(11) NOT NULL default '0',
 
`user_timezone` tinyint(4) NOT NULL default '10',
 
`user_style` tinyint(4) default NULL,
 
`user_lang` varchar(255) NOT NULL default 'spanish',
 
`user_dateformat` varchar(14) NOT NULL default 'D M d, Y g:i a',
 
`user_new_privmsg` smallint(5) unsigned NOT NULL default '0',
 
`user_unread_privmsg` smallint(5) unsigned NOT NULL default '0',
 
`user_last_privmsg` int(11) NOT NULL default '0',
 
`user_emailtime` int(11) default NULL,
 
`user_allowhtml` tinyint(1) default '1',
 
`user_allowbbcode` tinyint(1) default '1',
 
`user_allowsmile` tinyint(1) default '1',
 
`user_allowavatar` tinyint(1) NOT NULL default '1',
 
`user_allow_pm` tinyint(1) NOT NULL default '1',
 
`user_allow_viewonline` tinyint(1) NOT NULL default '1',
 
`user_notify` tinyint(1) NOT NULL default '0',
 
`user_notify_pm` tinyint(1) NOT NULL default '0',
 
`user_popup_pm` tinyint(1) NOT NULL default '0',
 
`user_avatar_type` tinyint(4) NOT NULL default '3',
 
`user_sig_bbcode_uid` varchar(10) default NULL,
 
`user_actkey` varchar(32) default NULL,
 
`user_newpasswd` varchar(32) default NULL,
 
`puntos` int(10) default '0',
 
`user_group_cp` int(11) NOT NULL default '2',
 
`user_group_list_cp` varchar(100) NOT NULL default '2',
 
`user_active_cp` enum('YES','NO') NOT NULL default 'YES',
 
`pais` varchar(50) NOT NULL default '',
 
`sexo` tinyint(2) NOT NULL default '0',
 
`nacimiento` date NOT NULL default '0000-00-00',
 
`acceso_priv` int(1) NOT NULL default '1',
 
`acceso_lista_priv` text NOT NULL,
 
`contenido_extra` text NOT NULL,
 
`perfil_extra` text NOT NULL,
 
`grupo_id` int(10) NOT NULL default '1',
 
PRIMARY KEY (`user_id`),
 
KEY `uid` (`user_id`),
 
KEY `uname` (`username`),
 
KEY `user_session_time` (`user_session_time`),
 
FULLTEXT KEY `user_avatar` (`user_avatar`),
 
FULLTEXT KEY `user_avatar_2` (`user_avatar`)
 
) TYPE=MyISAM AUTO_INCREMENT=113566 ;
 
-- 
 
-- Volcar la base de datos para la tabla `nuke_users`
 
-- 
 
INSERT INTO `nuke_users` VALUES (48846, '', '123stella', '[email protected]', '', '', '', 0, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, 'bed80749f34608108def336c', 10, '', 0, 0, 0, '', 0, '', '', 4096, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 10, NULL, 'spanish', 'D M d, Y g:i a', 0, 0, 0, NULL, 1, 1, 1, 1, 1, 1, 0, 0, 0, 3, NULL, NULL, NULL, 0, 2, '2', 'YES', '', 0, '0000-00-00', 1, '', '', '', 1);
 
INSERT INTO `nuke_users` VALUES (80979, '', '123stella', '[email protected]', '', '', '', 0, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, 'bed80749f346008108def336c', 10, '', 0, 0, 0, '', 0, '', '', 4096, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 10, NULL, 'spanish', 'D M d, Y g:i a', 0, 0, 0, NULL, 1, 1, 1, 1, 1, 1, 0, 0, 0, 3, NULL, NULL, NULL, 0, 2, '2', 'YES', '', 0, '0000-00-00', 1, '', '', '', 1);
 
INSERT INTO `nuke_users` VALUES (100576, '', '123stella', '[email protected]'., '', '', '', 0, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, 'bed80749f3469037e008108def336c', 10, '', 0, 0, 0, '', 0, '', '', 4096, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 10, NULL, 'spanish', 'D M d, Y g:i a', 0, 0, 0, NULL, 1, 1, 1, 1, 1, 1, 0, 0, 0, 3, NULL, NULL, NULL, 0, 2, '2', 'YES', '', 0, '0000-00-00', 1, '', '', '', 1);
 
INSERT INTO `nuke_users` VALUES (14320, '', '130n', '[email protected]', '', '', 'blank.gif', 108660, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, 'd3dd22a3c30e02c9c0cf04277689', 10, '', 0, 0, 0, '', 0, '', '', 4096, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 10, NULL, '', 'D M d, Y g:i a', 0, 0, 0, NULL, 1, 1, 1, 1, 1, 1, 0, 0, 0, 3, NULL, NULL, NULL, 0, 2, '2', 'YES', '', 0, '0000-00-00', 1, '', '', '', 1);
 
INSERT INTO `nuke_users` VALUES (68841, '', '130n', '[email protected]', '', '', '', 0, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, 'd3dd22a5498cf689', 10, '', 0, 0, 0, '', 0, '', '', 4096, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 10, NULL, 'spanish', 'D M d, Y g:i a', 0, 0, 0, NULL, 1, 1, 1, 1, 1, 1, 0, 0, 0, 3, NULL, NULL, NULL, 0, 2, '2', 'YES', '', 0, '0000-00-00', 1, '', '', '', 1);
 
INSERT INTO `nuke_users` VALUES (88370, '', '130n', '[email protected]', '', '', '', 0, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, NULL, 'd3dd22a54902c9277689', 10, '', 0, 0, 0, '', 0, '', '', 4096, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 10, NULL, 'spanish', 'D M d, Y g:i a', 0, 0, 0, NULL, 1, 1, 1, 1, 1, 1, 0, 0, 0, 3, NULL, NULL, NULL, 0, 2, '2', 'YES', '', 0, '0000-00-00', 1, '', '', '', 1);
 
 
__________________
--------------------------
QUINCHOS WILFREDO, http://www.quinchoswilfredo.com

Última edición por swishts; 03/03/2005 a las 17:10