Ver Mensaje Individual
  #9 (permalink)  
Antiguo 15/02/2013, 09:11
Avatar de Triby
Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: agregar datos a un arreglo json

Creo que hay que regresar al JOIN anterior:

Código PHP:
Ver original
  1. $query = "select t_u.*, t_edo.nombre as nestado, t_ciu.nombre as nciudad, t_mun.nombre_municipio as nmunicipio";
  2. $query .= " from t_usuarios t_u";
  3. $query .= " LEFT JOIN t_estados t_edo on t_edo.estado = t_u.estado AND t_edo.ciudad = ''"; // Agregamos ciudad (vacía)
  4. $query .= " LEFT JOIN t_estados t_ciu on t_ciu.ciudad = t_u.ciudad AND t_ciu.estado = t_u.estado";  // Agregamos estado
  5. $query .= " LEFT JOIN t_municipio t_mun on t_mun.municipio = t_u.municipio";
  6. $query .= " where t_u.status='' and (t_u.nombre LIKE '%$q%' OR t_u.matricula LIKE '%$q%') limit $offset,$rows";

Con eso ya no debería repetir datos.
__________________
- León, Guanajuato
- GV-Foto