Respuesta: Problemas con arrays Muchas gracias de nuevo mortiprogramador y quinqui por vuestros comentarios.
#mortiprogramador, lo que pretendo con el if es ir llenando el $array no si este está vacio, si no si no existe el Consultor o el día dentro del array.
Voy pegando la estructura de la BDTabla Consultores
Código:
CREATE TABLE `consultores` (
`Ident_consultor` int(11) NOT NULL auto_increment,
`consultor` varchar(50) character set utf8 NOT NULL,
`f_inicio` date NOT NULL,
`f_fin` date default NULL,
`facturacion` varchar(15) character set utf8 NOT NULL,
`tarifa` int(11) default NULL,
`costesalarial` int(11) default NULL,
`usuario` varchar(20) NOT NULL,
`password` varchar(20) NOT NULL,
`admin` tinyint(1) default NULL,
`codconsultor` varchar(3) NOT NULL,
`cliente` tinyint(1) NOT NULL,
`esconsultor` tinyint(1) default NULL,
`reporte_habitual` tinyint(1) NOT NULL,
`escoordinador` tinyint(1) default NULL,
`correo` varchar(100) NOT NULL,
PRIMARY KEY (`Ident_consultor`)
) ENGINE=MyISAM DEFAULT CHARSET=ucs2 AUTO_INCREMENT=119 ;
INSERT INTO `consultores` VALUES (66, 'Daniel Paniagua', '2012-03-28', '0000-00-00', '', 0, 0, 'dpaniagua', 'dpaniagua', 0, '008', 0, 1, 1, 0, '');
INSERT INTO `consultores` VALUES (67, 'David Garcia Rodriguez', '2012-03-28', '0000-00-00', '', 0, 0, 'dgarcia', 'dgarcia', 0, '066', 0, 1, 1, 0, '');
INSERT INTO `consultores` VALUES (68, 'Dragos Manea', '2012-03-28', '0000-00-00', '', 0, 0, 'dmanea', 'dmanea', 0, '032', 0, 1, 1, 0, '');
INSERT INTO `consultores` VALUES (69, 'Fernando Cana', '2012-03-28', '0000-00-00', '', 0, 0, 'fcana', 'fcana', 0, '011', 0, 1, 1, 0, '');
Tabla Trabajos
Código:
CREATE TABLE `trabajos` (
`idtrabajo` int(11) NOT NULL auto_increment,
`indi` text NOT NULL,
`grupo` varchar(10) NOT NULL,
`cliente` smallint(6) NOT NULL,
`ot` int(11) NOT NULL,
`proyecto` smallint(6) NOT NULL,
`interlocutor` smallint(6) NOT NULL,
`f_inicio` date NOT NULL,
`f_fin` date NOT NULL,
`f_reporte` date NOT NULL,
`dia` int(11) NOT NULL,
`mes` int(11) default NULL,
`ano` int(11) NOT NULL,
`semana` int(11) NOT NULL,
`descripcion` text NOT NULL,
`cantidad2` smallint(6) NOT NULL,
`cantidad` double NOT NULL,
`escalado` double NOT NULL,
`escaladoK25` double NOT NULL,
`descripcionescalado` text,
`tiempo_real` double NOT NULL,
`preciototal` float NOT NULL,
`preciototalK25` float NOT NULL,
`pago_actuacion` tinyint(1) default NULL,
`nocturna` tinyint(1) default NULL,
`comentarios` text,
`status_idstatus` smallint(6) NOT NULL,
`descripcionstatus` text,
`actividades_Id_actividad` smallint(6) NOT NULL,
`idactiv_tall` int(11) NOT NULL,
`consultores_Ident_consultor` int(11) NOT NULL,
`pagohoras` tinyint(1) default NULL,
`horas` smallint(6) default NULL,
`comentariosclientes` text NOT NULL,
`estadocliente` varchar(20) NOT NULL,
`comentarios_altran` text,
PRIMARY KEY (`idtrabajo`),
KEY `dia` (`dia`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=25245 ;
Gracias y Saludos!! |