Ver Mensaje Individual
  #5 (permalink)  
Antiguo 13/06/2008, 07:56
Avatar de T4ke0veR
T4ke0veR
 
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 9 meses
Puntos: 28
Respuesta: como se guardan los datos en mas de una tabla

a83 lo q deseas es hacer en realidad dos tablas...
una q seria por ejemplo

tabla empleado
Código PHP:
CREATE TABLE `empleado` (
  `
idint(11NOT NULL auto_increment,
  `
nombretext NOT NULL,
  `
apellidotext NOT NULL,
  `
telefonotext NOT NULL,
  
PRIMARY KEY  (`id`)
ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=
Tabla sueldo
Código PHP:
CREATE TABLE `sueldo` (
  `
idint(11NOT NULL auto_increment,
  `
id_empleadoint(11NOT NULL,
  `
direcciontext NOT NULL,
  `
sueldotext NOT NULL,
  
PRIMARY KEY  (`id`)
ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=
luego para relacionarlos hacias algo como

consulta 1
Código PHP:
$sqlex "SELECT * FROM empleado"
declaras una variable
[php]
$variable_id = $rowex['id'];

y tu consulta2
Código PHP:
$sqlex2 "SELECT * FROM sueldo WHERE id_empleado = $variable_id"
es una manera de relacionar corrijanme si me equivoco...
suerte :)
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...