Ver Mensaje Individual
  #6 (permalink)  
Antiguo 04/07/2013, 09:45
pefeli
 
Fecha de Ingreso: marzo-2013
Mensajes: 4
Antigüedad: 11 años, 1 mes
Puntos: 0
Respuesta: Como soluciono esto? Fatal Error: Class 'ctrlConexion' not found

Fueron creados por mi, acá los voy a listar

ctrlConexion:

<?
class ctrlConexion
{

var $Enlace;

function Conectar()
{
$Servidor = 'localhost';
$Usuario = 'root';
$Password = '';
$BD = 'carguemicrosoft';

$Enlace = mysqli_connect($Servidor, $Usuario, $Password, $BD);

if (!$Enlace)
{
die('Error de Conexión (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}

return $Enlace;
}

function EjecutarSQL($Enlace, $Consulta)
{
$RecordSet = mysqli_query($Enlace, $Consulta);

return $RecordSet;
}

function Cerrar($Enlace)
{
mysqli_close($Enlace);
}
}
?>

-----------------------------------------------------------------------------------

Producto:

<?php
class Producto
{
//Defino Variables
var $intCodigo;
var $strNombre;
var $dblPrecio;
var $strError;

//Constructor
function Producto($Codigo, $Nombre, $Precio, $Error)
{
$this -> intCodigo = $Codigo;
$this -> strNombre = $Nombre;
$this -> dblPrecio = $Precio;
$this -> strError = $Error;
}

//Asigno Variables de ENTRADA y SALIDA
function getCodigo()
{
return $this -> intCodigo;
}

function setCodigo($Codigo)
{
$this -> intCodigo = $Codigo;
}

//--\\

function getNombre()
{
return $this -> strNombre;
}

function setNombre($Nombre)
{
$this -> strNombre = $Nombre;
}

//--\\

function getPrecio()
{
return $this -> dblPrecio;
}

function setPrecio($Precio)
{
$this -> dblPrecio = $Precio;
}

//--\\

function getError()
{
$this -> strError;
}

function setError($Error)
{
$this -> strError = $Error;
}

}
?>

----------------------------------------------------------------------------

ctrlProducto:

<?php
//Inclusión de Archivos Necesarios
include_once 'ctrlConexion.php';

class ctrlProducto
{
//Defino Variables
var $objProducto;
var $RecordSet;
var $Error;

//Constructor
function ctrlProducto($objProducto)
{
$this -> objProducto = $objProducto;
}

//Funciones Operativas
function Guardar()
{
$intCodigo = $this -> objProducto -> getCodigo();
$strNombre = $this -> objProducto -> getNombre();
$dblPrecio = $this -> objProducto -> getPrecio();
$strError = $this -> objProducto -> getError();

//Nos Conectamos a la Base de Datos
$objConexion = new ctrlConexion();
$Enlace = $objConexion -> Conectar();

//Se Ejecuta el Comando SQL
$Consulta = "INSERT INTO tblPROducto VALUES('".$intCodigo."','".$strNombre."','".$dblPr ecio."')";
$RecordSet = $objConexion -> EjecutarSQL($Enlace, $Consulta);
$objConexion -> Cerrar($Enlace);

//Verificamos el Resultado de la Consulta
if (!$RecordSet)
{
$strError = "Error en la Consulta: \n".mysqli_error($Enlace);
}
else
{
$this -> RecordSet = $RecordSet;
$strError = "";
}
}

}
?>

-------------------------------------------------------------------------------------

VistaProducto:

<?php
/*session_start();
if ($_SESSION["Rgtro"] != "Si")
{
header("Location:Index.php");
}
$strUsuario = $_SESSION["User"];*/

//Inclusión de Archivos Necesarios
include_once ("../Modelo/Producto.php");
include_once ("../Control/ctrlProducto.php");
//include_once ("../Control/ctrlConexion.php");


//Definición de Variables
$intCodigo;
$strNombre;
$dblPrecio;
$strError;
$btnBoton;

try
{
//Capturo la Información Enviada
$intCodigo = isset($_POST['txtCodigo']) ? $_POST['txtCodigo'] : null;
$strNombre = isset($_POST['txtNombre']) ? $_POST['txtNombre'] : null;
$dblPrecio = isset($_POST['txtPrecio']) ? $_POST['txtPrecio'] : null;
$btnBoton = isset($_POST['Boton']) ? $_POST['Boton'] : null;

switch ($btnBoton)
{
case "Guardar":
if ((is_null($intCodigo) || empty($intCodigo)) || (is_null($strNombre) || empty($strNombre)) ||
(is_null($dblPrecio) || empty($dblPrecio)))
{
echo "
<script languaje=\"JavaScript\" type=\"text/javascript\">
alert(\"Ingrese todos los Datos para Continuar.\")
</script>";
break;
}

$objProducto = new Producto($intCodigo, $strNombre, $dblPrecio, "");
$objctrlProducto = new ctrlProducto($objProducto);
$objctrlProducto -> Guardar();

$intCodigo = $objProducto -> getCodigo();
$strNombre = $objProducto -> getNombre();
$dblPrecio = $objProducto -> getPrecio();
$strError = $objProducto -> getError();

echo "
<script languaje=\"JavaScript\" type=\"text/javascript\">
alert(\"Producto Guardado con Éxito.\")
</script>";
break;
}
}
catch (Exception $e)
{
$strError = "Error: ".$e -> getMessage();
}

?>

<html>
<head>
<title>Producto</title>
</head>
<body>
<form action="VistaProducto.php" method="post" name="frmProducto">
<table>
<tr>
<td colspan="2" style= "text-align: center"><h2>Producto</h2>
</tr>
<tr>
<td><br></td>
</tr>
<tr>
<td style= "text-align: right">Código:</td>
<td style= "text-align: left"><input name="txtCodigo" value=<?php $intCodigo ?>></td>
</tr>
<tr>
<td style= "text-align: right">Nombre:</td>
<td style= "text-align: left"><input name="txtNombre" value=<?php $strNombre ?>></td>
</tr>
<tr>
<td style= "text-align: right">Precio:</td>
<td style= "text-align: left"><input name="txtPrecio" value=<?php $dblPrecio ?>></td>
</tr>
</table>
<br>
<table>
<tr>
<td align="center"><input name="Boton" value="Guardar" type="submit"></td>
<td align="center"><input name="Boton" value="Consultar" type="submit"></td>
<td align="center"><input name="Boton" value="Modificar" type="submit"></td>
<td align="center"><input name="Boton" value="Borrar" type="submit"></td>
<td align="center"><input name="Boton" value="Listar" type="submit"></td>
<td align="center"><input type="reset"></td>
</tr>
</table>

</form>
</body>
</html>