Respuesta: Error mysql 1452 al insertar registros tablas relacionadas ok si entiendo! lo que quiero es cargar todos esos datos por medio del formulario en ese caso como haria para cargas los datos! trabajo por medio del modelo MVC
modelo: clsCharla.php
<?
require_once("clsDatos.php");
class clsCharla extends clsDatos
{
private $acCedula;
private $acNombre;
private $acApellido;
private $acSexo;
private $acFechaNacimiento;
private $acDireccion;
private $acTelefono;
private $acCorreo;
private $acCodigoCharla;
private $acTipoCharla;
private $acCantidadParticipantes;
private $acTipoParticipantes;
private $acLugarCharla;
private $acFechaDisponible;
private $acNombreInstitucion;
private $acDireccionInstitucion;
private $acTelefonoInstitucion;
private $acTipoInstitucion;
public function __construct()
{
$this->acCedula="";
$this->acNombre="";
$this->acApellido="";
$this->acSexo="";
$this->acFechaNacimiento="";
$this->acDireccion="";
$this->acTelefono="";
$this->acCorreo="";
$this->acCodigoCharla="";
$this->acTipoCharla="";
$this->acCantidadParticipantes="";
$this->acTipoParticipantes="";
$this->acLugarCharla="";
$this->acFechaDisponible="";
$this->acNombreInstitucion="";
$this->acDireccionInstitucion="";
$this->acTelefonoInstitucion="";
$this->acTipoInstitucion="";
}
public function __destruct()
{
}
public function setcCedula($pcCedula)
{
$this->acCedula=$pcCedula;
}
public function setcNombre($pcNombre)
{
$this->acNombre=$pcNombre;
}
public function setcApellido($pcApellido)
{
$this->acApellido=$pcApellido;
}
public function setcSexo($pcSexo)
{
$this->acSexo=$pcSexo;
}
public function setcFechaNacimiento($pcFechaNacimiento)
{
$this->acFechaNacimiento=$pcFechaNacimiento;
}
public function setcDireccion($pcDireccion)
{
$this->acDireccion=$pcDireccion;
}
public function setcTelefono($pcTelefono)
{
$this->acTelefono=$pcTelefono;
}
public function setcCorreo($pcCorreo)
{
$this->acCorreo=$pcCorreo;
}
public function setcCodigoCharla($pcCodigoCharla)
{
$this->acCodigoCharla=$pcCodigoCharla;
}
public function setcTipoCharla($pcTipoCharla)
{
$this->acTipoCharla=$pcTipoCharla;
}
public function setcCantidadParticipantes($pcCantidadParticipantes )
{
$this->acCantidadParticipantes=$pcCantidadParticipante s;
}
public function setcTipoParticipantes($pcTipoParticipantes)
{
$this->acTipoParticipantes=$pcTipoParticipantes;
}
public function setcLugarCharla($pcLugarCharla)
{
$this->acLugarCharla=$pcLugarCharla;
}
public function setcFechaDisponible($pcFechaDisponible)
{
$this->acFechaDisponible=$pcFechaDisponible;
}
public function setcNombreInstitucion($pcNombreInstitucion)
{
$this->acNombreInstitucion=$pcNombreInstitucion;
}
public function setcDireccionInstitucion($pcDireccionInstitucion)
{
$this->acDireccionInstitucion=$pcDireccionInstitucion;
}
public function setcTelefonoInstitucion($pcTelefonoInstitucion)
{
$this->acTelefonoInstitucion=$pcTelefonoInstitucion;
}
public function setcTipoInstitucion($pcTipoInstitucion)
{
$this->acTipoInstitucion=$pcTipoInstitucion;
}
public function getcCedula()
{
return $this->acCedula;
}
public function getcNombre()
{
return $this->acNombre;
}
public function getcApellido()
{
return $this->acApellido;
}
public function getcSexo()
{
return $this->acSexo;
}
public function getcFechaNacimiento()
{
return $this->acFechaNacimiento;
}
public function getcDireccion()
{
return $this->acDireccion;
}
public function getcTelefono()
{
return $this->acTelefono;
}
public function getcCorreo()
{
return $this->acCorreo;
}
public function getcCodigoCharla()
{
return $this->acCodigoCharla;
}
public function getcTipoCharla()
{
return $this->acTipoCharla;
}
public function getcCantidadParticipantes()
{
return $this->acCantidadParticipantes;
}
public function getcTipoParticipantes()
{
return $this->acTipoParticipantes;
}
public function getcLugarCharla()
{
return $this->acLugarCharla;
}
public function getcFechaDisponible()
{
return $this->acFechaDisponible;
}
public function getcNombreInstitucion()
{
return $this->acNombreInstitucion;
}
public function getcDireccionInstitucion()
{
return $this->acDireccionInstitucion;
}
public function getcTelefonoInstitucion()
{
return $this->acTelefonoInstitucion;
}
public function getcTipoInstitucion()
{
return $this->acTipoInstitucion;
}
public function buscar()
{
$llEnc=false;
$lcSql="select * from responsable,charla,institucion where(cedula='$this->acCedula') and charla.idcharla=responsable.idcharla and institucion.idinstitucion=responsable.idinstitucio n";
$this->conectar();
$lrTb=$this->filtro($lcSql);
if($laRow=$this->proximo($lrTb))
{
$this->acCedula=$laRow["cedula"];
$this->acNombre=$laRow["nombre"];
$this->acApellido=$laRow["apellido"];
$this->acSexo=$laRow["sexo"];
$this->acFechaNacimiento=$laRow["fecha_naci"];
$this->acDireccion=$laRow["direccion"];
$this->acTelefono=$laRow["telefono"];
$this->acCorreo=$laRow["correo"];
$this->acCodigoCharla=$laRow["idcharla"];
$this->acTipoCharla=$laRow["tipo_charla"];
$this->acCantidadParticipantes=$laRow["cantidad_participantes"];
$this->acTipoParticipantes=$laRow["tipo_participantes"];
$this->acLugarCharla=$laRow["lugar_charla"];
$this->acFechaDisponible=$laRow["fecha_disponible"];
$this->acNombreInstitucion=$laRow["idinstitucion"];
$this->acDireccionInstitucion=$laRow["direccion"];
$this->acTelefonoInstitucion=$laRow["telefono"];
$this->acTipoInstitucion=$laRow["tipo_institucion"];
$llEnc=true;
}
$this->cierrafiltro($lrTb);
$this->desconectar();
return $llEnc;
}
public function incluir()
{
$llHecho=false;
$this->conectar();
$lcSql="insert into responsable(cedula,nombre,apellido,sexo,fecha_naci ,direccion,telefono,correo) values ('$this->acCedula','$this->acNombre','$this->acApellido','$this->acSexo','$this->acFechaNacimiento','$this->acDireccion','$this->acTelefono','$this->acCorreo')";
$llHecho=$this->ejecutar($lcSql);
$lcSql="insert into charla(idcharla,tipo_charla,cantidad_participantes ,tipo_participantes,lugar_charla,fecha_disponible) values ('$this->acCodigoCharla','$this->acTipoCharla','$this->acCantidadParticipantes','$this->acTipoParticipantes','$this->acLugarCharla','$this->acFechaDisponible')";
$llHecho=$this->ejecutar($lcSql);
$lcSql="insert into institucion(idinstitucion,direccion,telefono,tipo_ institucion) values ('$this->acNombreInstitucion','$this->acDireccionInstitucion','$this->acTelefonoInstitucion','$this->acTipoInstitucion')";
$llHecho=$this->ejecutar($lcSql);
$this->desconectar();
return $llHecho;
}
public function modificar()
{
$llHecho=false;
$this->conectar();
$lcSql="update responsable set nombre='$this->acNombre',apellido='$this->acApellido',sexo='$this->acSexo',fecha_naci='$this->acFechaNacimiento',direccion='$this->acDireccion',telefono='$this->acTelefono',correo='$this->acCorreo' where (cedula='$this->acCedula')";
$llHecho=$this->ejecutar($lcSql);
$lcSql="update charla set tipo_charla='$this->acTipoCharla',cantidad_participantes='$this->acCantidadParticipantes',tipo_participantes='$thi s->acTipoParticipantes',lugar_charla='$this->acLugarCharla',fecha_disponible='$this->acFechaDisponible' where (idcharla='$this->acCodigoCharla')";
$llHecho=$this->ejecutar($lcSql);
$lcSql="update institucion set direccion='$this->acDireccionInstitucion',telefono='$this->acTelefonoInstitucion',tipo_institucion='$this->acTipoInstitucion' where (idinstitucion='$this->acNombreInstitucion')";
$llHecho=$this->ejecutar($lcSql);
$this->desconectar();
return $llHecho;
}
public function eliminar()
{
$llHecho=false;
$lcSql="delete from responsable where (cedula='$this->acCedula')";
$this->conectar();
$llHecho=$this->ejecutar($lcSql);
$this->desconectar();
return $llHecho;
}
}
?> |