funcion php ola soy nuevo en el mundo de la poo en php y pues solo necesito saber si alguien me podria decir si esta funcion la cual me sirve para un crud y pues nada solo queria saber si esta bn o por k no me funciona vale muchas gracias colegas........
<?php
include_once 'sqlsito.php';
class CRUD_Det {
private $conexion;
private $Cabecera_Cod_Doc;
private $Cabecera_Num_Doc;
private $referencia_Cod_Referencia;
private $Nombre_Ref;
private $linea;
private $fecha;
private $tipodetalle;
private $lote;
private $cantidad;
private $ubicacion;
private $observacion;
private $periodo;
private $resultado;
private $sql;
private $id;
public function insertar($Cabecera_Cod_Doc,$Cabecera_Num_Doc,$refe rencia_Cod_Referencia,$Nombre_Ref,$linea,$fecha,$t ipodetalle,$lote,$cantidad,$ubicacion,$observacion ,$periodo) {
$this->Cabecera_Cod_Doc = $Cabecera_Cod_Doc;
$this->Cabecera_Num_Doc = $Cabecera_Num_Doc;
$this->referencia_Cod_Referencia = $referencia_Cod_Referencia;
$this->Nombre_Ref = $Nombre_Ref;
$this->linea = $linea ;
$this->fecha = $fecha;
$this->tipodetalle = $tipodetalle;
$this->lote = $lote;
$this->cantidad = $cantidad;
$this->ubicacion = $ubicacion;
$this->observacion = $observacion;
$this->periodo = $periodo;
$objmysql = new sqlsito();
$this->conexion = $objmysql->conectarBD();
$this->sql = "INSERT INTO `inventario3`.`detalles` (`Cabecera_Cod_Doc`, `Cabecera_Num_Doc`, `referencia_Cod_Referencia`, `Nombre_Ref`, `linea`, `fecha`, `tipodetalle`, `lote`, `cantidad`, `ubicacion`, `observacion`, `periodo`) VALUES ('$this->Cabecera_Cod_Doc', '$this->Cabecera_Num_Doc', '$this->referencia_Cod_Referencia','$this->Nombre_Ref', '$this->linea', '$this->fecha', '$this->tipodetalle', '$this->lote', '$this->cantidad', '$this->ubicacion', '$this->observacion', '$this->periodo');";
$this->resultado = mysql_query($this->sql);
$this->conexion = $objmysql->desconectar();
if ($this->resultado == true) {
return 'se logro';
} else {
return 'no se logro';
}
}
public function modificar() {
$objmysql = new mysql();
$this->conexion = $objmysql->conectarBD();
$this->id = $id;
$this->sql="UPDATE `inventario3`.`detalles` SET `Cabecera_Cod_Doc` = '$this->Cabecera_Cod_Doc' , `Cabecera_Num_Doc` = '$this->Cabecera_Num_Doc' , `referencia_Cod_Referencia` = '$this->referencia_Cod_Referencia' , `Nombre_Ref` = '$this->Nombre_Ref' , `linea` = '$this->linea' , `fecha` = '$this->fecha' , `tipodetalle` = '$this->tipodetalle', `lote` = '$this->lote', `cantidad` = '$this->cantidad', `ubicacion` = '$this->ubicacion',`observacion` = '$this->observacion',`periodo` = '$this->periodo' WHERE `idDetalles` = '$this->id' ";
$this->resultado = mysql_query($this->sql, $this->conexion);
return $this->resultado;
}
public function eliminar($id) {
$objmysql = new mysql();
$this->conexion = $objmysql->conectarBD();
$this->id = $id;
$this->sql="DELETE FROM `inventario3`.`detalles` WHERE idDetalles = '$this->id'";
$this->resultado = mysql_query($this->sql, $this->conexion);
return $this->resultado;
}
}
?> |