PHP - Ayuda a manejar datos

 
Vista:
sin imagen de perfil

Ayuda a manejar datos

Publicado por Francisco (2 intervenciones) el 30/12/2017 06:39:20
Estiamdos buenas noches,

Necesito de su orientacion, tengo el siguiente problema tengo una tabla y una de las columna se llama notifs la cual tiene multiples datos.

ejemplo parcial de la consulta.

Francisco25, [pm][email][cat9][cat14][cat20][cat32],
abuelita, [pm][email][cat9][cat14][cat20][cat32],
Edson, [pm][email],


Necesito eliminar de todos los usuarios [pm] pero no se me ocurre como, ya que se debe mantener el resto de la informacion [email][cat9][cat14][cat20][cat32],

aca colo parte del codigo conque rescato los datos.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$query_Tabla = "SELECT u.id,u.username,u.email,u.notifs FROM users1 u WHERE notifs LIKE '%[pm]%'";
       $Tabla = mysql_query($query_Tabla, $mi_conexion) or die(mysql_error());
       while ($row_Tabla=mysql_fetch_array($Tabla)) {
        $losemails.=($row_Tabla['username'].", ");
        $losemails.=($row_Tabla['notifs'].", ");
      }
    $largo=strlen($losemails);
   if ($largo>2)
   {
//quitamos ultimos ", "
$losemails=substr($losemails,0,$largo-2);
echo "$losemails";
}
else
{
//echo "No hay";
};

base

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
-- phpMyAdmin SQL Dump
-- version 4.6.6
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 30-12-2017 a las 03:44:42
-- Versión del servidor: 5.5.58-0ubuntu0.14.04.1
-- Versión de PHP: 5.6.30
 
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
 
 
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
 
 
-- --------------------------------------------------------
 
--
-- Estructura de tabla para la tabla `users1`
--
 
CREATE TABLE `users1` (
  `id` int(10) UNSIGNED NOT NULL,
  `username` char(32) NOT NULL,
  `passhash` char(32) NOT NULL,
  `secret` char(20) NOT NULL,
  `email` char(64) NOT NULL,
  `status` enum('pending','confirmed') NOT NULL DEFAULT 'pending',
  `enabled` enum('yes','no') NOT NULL DEFAULT 'yes',
  `added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_login` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_access` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `stylesheet` char(32) DEFAULT NULL,
  `ip` char(15) NOT NULL,
  `uploaded` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  `downloaded` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  `title` char(30) NOT NULL,
  `country` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `notifs` mediumtext,
  `modcomment` longtext NOT NULL,
  `donor` enum('yes','no') NOT NULL DEFAULT 'no',
  `warned` enum('yes','no') NOT NULL DEFAULT 'no',
  `warneduntil` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `torrentsperpage` tinyint(2) UNSIGNED NOT NULL DEFAULT '0',
  `torrent_pass` char(32) NOT NULL,
  `tzoffset` char(4) NOT NULL,
  `invites` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `invited_by` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `seedbonus` decimal(9,1) NOT NULL DEFAULT '0.0',
  `leechwarn` enum('yes','no') NOT NULL DEFAULT 'no',
  `leechwarnuntil` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `timeswarned` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `page` varchar(100) NOT NULL,
  `donated` decimal(10,2) NOT NULL DEFAULT '0.00',
  `donoruntil` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `total_donated` decimal(10,2) NOT NULL DEFAULT '0.00',
  `lastinvite` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `announce_read` enum('yes','no') NOT NULL DEFAULT 'yes',
  `usergroup` smallint(5) UNSIGNED NOT NULL DEFAULT '0',
  `oldusergroup` int(10) UNSIGNED NOT NULL DEFAULT '2',
  `last_forum_visit` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `last_forum_active` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `avatar` varchar(200) NOT NULL,
  `postsperpage` tinyint(3) UNSIGNED NOT NULL DEFAULT '0',
  `signature` mediumtext NOT NULL,
  `totalposts` bigint(30) UNSIGNED NOT NULL DEFAULT '0',
  `birthday` char(10) NOT NULL DEFAULT '',
  `visitorcount` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `options` char(38) NOT NULL DEFAULT 'A0B0C0D1E1F0G1H1I2K1L1M1N1O0P1R0S1Q0T0',
  `pmunread` smallint(5) UNSIGNED NOT NULL DEFAULT '0',
  `speed` char(5) NOT NULL DEFAULT '0~0',
  `contact` varchar(255) NOT NULL,
  `mood` tinyint(2) UNSIGNED NOT NULL DEFAULT '0',
  `can_leech` tinyint(1) UNSIGNED NOT NULL DEFAULT '1',
  `wait_time` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `peers_limit` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `torrents_limit` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `torrent_pass_version` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `download_multiplier` float NOT NULL DEFAULT '1',
  `upload_multiplier` float NOT NULL DEFAULT '1',
  `blackjacklost` int(10) NOT NULL DEFAULT '0',
  `blackjackwon` int(10) NOT NULL DEFAULT '0',
  `premio` varchar(3) NOT NULL,
  `premio50` varchar(3) NOT NULL,
  `vipfree` varchar(3) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
--
-- Volcado de datos para la tabla `users1`
--
 
INSERT INTO `users1` (`id`, `username`, `passhash`, `secret`, `email`, `status`, `enabled`, `added`, `last_login`, `last_access`, `stylesheet`, `ip`, `uploaded`, `downloaded`, `title`, `country`, `notifs`, `modcomment`, `donor`, `warned`, `warneduntil`, `torrentsperpage`, `torrent_pass`, `tzoffset`, `invites`, `invited_by`, `seedbonus`, `leechwarn`, `leechwarnuntil`, `timeswarned`, `page`, `donated`, `donoruntil`, `total_donated`, `lastinvite`, `announce_read`, `usergroup`, `oldusergroup`, `last_forum_visit`, `last_forum_active`, `avatar`, `postsperpage`, `signature`, `totalposts`, `birthday`, `visitorcount`, `options`, `pmunread`, `speed`, `contact`, `mood`, `can_leech`, `wait_time`, `peers_limit`, `torrents_limit`, `torrent_pass_version`, `download_multiplier`, `upload_multiplier`, `blackjacklost`, `blackjackwon`, `premio`, `premio50`, `vipfree`) VALUES
(1, 'Francisco25', '05b8f02a996a587690be3f5f71f247a0', 'NYGVGqv6J33g44xvQrCT', 'franciscoz@v.net', 'confirmed', 'yes', '2008-07-13 20:55:20', '2017-12-29 23:25:16', '2017-12-29 23:25:17', 'default', '10.64.15.213', 457924026978426, 0, '', 51, '[pm][email][cat9][cat14][cat20][cat32]', '2017-12-02 - Earned 3 invites by system.\r\n', 'no', 'no', '0000-00-00 00:00:00', 40, '2e64592d2313b6e9cbb08273e', '-4', 103, 0, '421243.9', 'no', '0000-00-00 00:00:00', 0, '', '0.00', '0000-00-00 00:00:00', '40.00', '2017-12-02 20:08:50', 'yes', 8, 8, 1503881923, 1512218837, '', 0, '', 42, '1-2-1982', 114, 'A0B0C1D1E1F0G0H1I2K1L1M1N0O1P0R1S1Q0T0', 0, '18~18', '', 24, 1, 0, 0, 0, 0, 1, 1, 0, 0, 'si', 'si', 'si');
 
--
-- Índices para tablas volcadas
--
 
--
-- Indices de la tabla `users1`
--
ALTER TABLE `users1`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `username` (`username`),
  ADD KEY `passkey` (`torrent_pass`),
  ADD KEY `uploaded` (`uploaded`),
  ADD KEY `added` (`added`),
  ADD KEY `last_forum_active` (`last_forum_active`),
  ADD KEY `usergroup` (`usergroup`),
  ADD KEY `warned` (`warned`,`leechwarn`),
  ADD KEY `status` (`status`,`timeswarned`),
  ADD KEY `downloaded` (`leechwarn`,`uploaded`,`downloaded`),
  ADD KEY `donor` (`donor`,`donoruntil`),
  ADD KEY `country` (`country`),
  ADD KEY `invited_by` (`invited_by`),
  ADD KEY `last_access` (`last_access`),
  ADD KEY `ip` (`ip`),
  ADD KEY `options` (`options`),
  ADD KEY `announce_read` (`announce_read`),
  ADD KEY `avatar` (`avatar`),
  ADD KEY `birthday` (`birthday`),
  ADD KEY `blackjacklost` (`blackjacklost`),
  ADD KEY `blackjackwon` (`blackjackwon`),
  ADD KEY `can_leech` (`can_leech`),
  ADD KEY `contact` (`contact`),
  ADD KEY `donated` (`donated`),
  ADD KEY `download_multiplier` (`download_multiplier`),
  ADD KEY `email` (`email`),
  ADD KEY `enabled` (`enabled`),
  ADD KEY `invites` (`invites`),
  ADD KEY `last_forum_visit` (`last_forum_visit`),
  ADD KEY `leechwarn` (`leechwarn`),
  ADD KEY `mood` (`mood`),
  ADD KEY `oldusergroup` (`oldusergroup`),
  ADD KEY `page` (`page`),
  ADD KEY `passhash` (`passhash`),
  ADD KEY `peers_limit` (`peers_limit`),
  ADD KEY `pmunread` (`pmunread`),
  ADD KEY `postsperpage` (`postsperpage`),
  ADD KEY `secret` (`secret`),
  ADD KEY `seedbonus` (`seedbonus`),
  ADD KEY `speed` (`speed`),
  ADD KEY `stylesheet` (`stylesheet`),
  ADD KEY `title` (`title`),
  ADD KEY `torrent_pass` (`torrent_pass`),
  ADD KEY `torrent_pass_version` (`torrent_pass_version`),
  ADD KEY `torrents_limit` (`torrents_limit`),
  ADD KEY `torrentsperpage` (`torrentsperpage`),
  ADD KEY `total_donated` (`total_donated`),
  ADD KEY `totalposts` (`totalposts`),
  ADD KEY `tzoffset` (`tzoffset`),
  ADD KEY `upload_multiplier` (`upload_multiplier`),
  ADD KEY `visitorcount` (`visitorcount`);
 
--
-- AUTO_INCREMENT de las tablas volcadas
--
 
--
-- AUTO_INCREMENT de la tabla `users1`
--
ALTER TABLE `users1`
  MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1250;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Quedo atento a cualquier ayuda.

Gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

Ayuda a manejar datos

Publicado por Francisco (2 intervenciones) el 02/01/2018 02:37:44
Solucionado

saludos y feliz 2018
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Ayuda a manejar datos

Publicado por xve (6935 intervenciones) el 02/01/2018 07:10:43
Hola Francisco, nos puedes compartir como lo has solucionado?

feliz 2018!!!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar