Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/11/2015, 00:17
allan_15marinez
 
Fecha de Ingreso: noviembre-2015
Mensajes: 2
Antigüedad: 8 años, 5 meses
Puntos: 0
Pregunta error en conexion de base de datos con pagina php

tengo una base de datos es esta


SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Base de datos: `ec`
--

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

--
-- Estructura de tabla para la tabla `datosfacturacion`
--

CREATE TABLE IF NOT EXISTS `datosfacturacion` (
`id_df` int(11) NOT NULL COMMENT 'es el id con el que se identifican los datos de facturacion',
`id_usuario` int(11) NOT NULL COMMENT 'es el id del campo usuario con el que se hace la relacion',
`nombre_df` text COLLATE utf8_bin NOT NULL COMMENT 'el nombre y apellidos de la persona',
`direccion_df` text COLLATE utf8_bin NOT NULL COMMENT 'La calle y numero de la persona',
`ciudad_df` text COLLATE utf8_bin NOT NULL COMMENT 'ciudad de la persona',
`estado_df` text COLLATE utf8_bin NOT NULL COMMENT 'estado de la persona',
`pais_df` text COLLATE utf8_bin NOT NULL COMMENT 'Pais donde reside la persona',
`cp_df` text COLLATE utf8_bin NOT NULL COMMENT 'codigo postal',
`telefono_df` text COLLATE utf8_bin NOT NULL COMMENT 'telefono de la persona',
`tarjeta_df` text COLLATE utf8_bin NOT NULL COMMENT 'numero de la tarjeta de credito',
`tipotarjeta_df` text COLLATE utf8_bin NOT NULL COMMENT 'el tipo de tarjeta (visa,master card,...)',
`estatus_df` varchar(20) COLLATE utf8_bin NOT NULL COMMENT 'estatus de los datos activos o no'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=12 ;



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

--
-- Estructura de tabla para la tabla `empleado`
--

CREATE TABLE IF NOT EXISTS `empleado` (
`id_empleado` int(200) NOT NULL,
`nombre_empleado` varchar(200) COLLATE utf8_bin NOT NULL,
`aplellido_empleado` varchar(200) COLLATE utf8_bin NOT NULL,
`telefono_empleado` varchar(200) COLLATE utf8_bin NOT NULL,
`direccion_empleado` varchar(200) COLLATE utf8_bin NOT NULL,
`contrasena_empleado` varchar(200) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2 ;


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

--
-- Estructura de tabla para la tabla `producto`
--

CREATE TABLE IF NOT EXISTS `producto` (
`id_producto` int(100) NOT NULL,
`nombre_producto` varchar(500) COLLATE utf8_bin NOT NULL,
`descripcion_producto` varchar(500) COLLATE utf8_bin NOT NULL,
`imagen_producto` varchar(500) COLLATE utf8_bin NOT NULL,
`precio_producto` double NOT NULL,
`categoria_producto` text COLLATE utf8_bin NOT NULL,
`fecha_producto` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=22 ;


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

--
-- Estructura de tabla para la tabla `transaccion`
--

CREATE TABLE IF NOT EXISTS `transaccion` (
`id_transaccion` int(11) NOT NULL COMMENT 'es el id de la transaccion',
`id_usuario` int(11) NOT NULL COMMENT 'id del usuario que realiza la transaccion',
`fecha_transaccion` date NOT NULL COMMENT 'fecha en la que se realiza la transaccion',
`total_transaccion` int(11) NOT NULL COMMENT 'total de la tansaccion',
`id_df` int(11) NOT NULL COMMENT 'id de los datos de facturacion'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;


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

--
-- Estructura de tabla para la tabla `usuarios`
--

CREATE TABLE IF NOT EXISTS `usuarios` (
`id_usuario` int(100) NOT NULL,
`nombre_usuario` varchar(100) COLLATE utf8_bin NOT NULL,
`contrasena_usuario` varchar(100) COLLATE utf8_bin NOT NULL,
`email_usuario` varchar(100) COLLATE utf8_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=8 ;

--
-- Volcado de datos para la tabla `usuarios`
--


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

--
-- Estructura de tabla para la tabla `ventas`
--

CREATE TABLE IF NOT EXISTS `ventas` (
`id_ven` int(11) NOT NULL COMMENT 'id de la venta',
`id_usuario` int(11) NOT NULL COMMENT 'id del usuario que realizo la compra',
`id_producto` int(11) NOT NULL COMMENT 'id de los productos comprados',
`precio_producto` int(11) NOT NULL COMMENT 'el precio del producto ',
`cantidadprod_ven` int(11) NOT NULL COMMENT 'total de los productos vendidos ',
`totalprod_ven` int(11) NOT NULL COMMENT 'total de los productos comprados',
`id_transaccion` int(11) NOT NULL COMMENT 'el id de la transaccion ala que pertenecen'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=66 ;


--
-- Índices para tablas volcadas
--

--
-- Indices de la tabla `datosfacturacion`
--
ALTER TABLE `datosfacturacion`
ADD PRIMARY KEY (`id_df`);

--
-- Indices de la tabla `empleado`
--
ALTER TABLE `empleado`
ADD PRIMARY KEY (`id_empleado`);

--
-- Indices de la tabla `producto`
--
ALTER TABLE `producto`
ADD PRIMARY KEY (`id_producto`);

--
-- Indices de la tabla `usuarios`
--
ALTER TABLE `usuarios`
ADD PRIMARY KEY (`id_usuario`), ADD UNIQUE KEY `id_usuario` (`id_usuario`,`email_usuario`);

--
-- Indices de la tabla `ventas`
--
ALTER TABLE `ventas`
ADD PRIMARY KEY (`id_ven`);

--
-- AUTO_INCREMENT de las tablas volcadas
--

--
-- AUTO_INCREMENT de la tabla `datosfacturacion`
--
ALTER TABLE `datosfacturacion`
MODIFY `id_df` int(11) NOT NULL AUTO_INCREMENT COMMENT 'es el id con el que se identifican los datos de facturacion',AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT de la tabla `empleado`
--
ALTER TABLE `empleado`
MODIFY `id_empleado` int(200) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT de la tabla `producto`
--
ALTER TABLE `producto`
MODIFY `id_producto` int(100) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT de la tabla `usuarios`
--
ALTER TABLE `usuarios`
MODIFY `id_usuario` int(100) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1;
--
-- AUTO_INCREMENT de la tabla `ventas`
--
ALTER TABLE `ventas`
MODIFY `id_ven` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id de la venta',AUTO_INCREMENT=1;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;





Esta base de datos esta unida a una pagina de ventas de pisos, y quiero hacer otra que me visualize solo todos los movimientos creados en estaaa :'(:'( , ya lo intente con
esta

<?php
require "PDO_Pagination.php";
/* Config Connection */
$root = 'root';
$password = '';
$host = 'localhost';
$dbname = 'ec';
$connection = new PDO("mysql:host=$host;dbname=$dbname;", $root, $password);
$pagination = new PDO_Pagination($connection);
$search = null;
if(isset($_REQUEST["search"]) && $_REQUEST["search"] != "")
{
$search = htmlspecialchars($_REQUEST["search"]);
$pagination->param = "&search=$search";
$pagination->rowCount("SELECT * FROM id_producto WHERE nombre_producto LIKE '%$search%' OR descripcion_producto LIKE '%$search%' OR precio_producto LIKE '%$search%'");
$pagination->config(3, 5);
$sql = "SELECT * FROM id_producto WHERE nombre_producto LIKE '%$search%' OR descripcion_producto LIKE '%$search%' OR id_name LIKE '%$search%' ORDER BY id_product ASC LIMIT $pagination->start_row, $pagination->max_rows";
$query = $connection->prepare($sql);
$query->execute();
$model = array();
while($rows = $query->fetch())
{
$model[] = $rows;
}
}
else
{
$pagination->rowCount("SELECT * FROM id_producto");
$pagination->config(3, 5);

$sql = "EXPLAIN SELECT * FROM `producto` ORDER BY id_producto ASC LIMIT $pagination->start_row, $pagination->max_rows";
$query = $connection->prepare($sql);
$query->execute();
$model = array();
while($rows = $query->fetch())
{
$model[] = $rows;
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>PDO Pagination</title>
</head>
<body>
<h1>PDO Pagination</h1>
<form method="POST" action="<?php echo $_SERVER["PHP_SELF"] ?>">
Search:
<input type="text" name="search" placeholder="Search" value="<?php echo $search ?>">
<input type="submit" value="Search">
</form>
<br><br>
<center>
<table cellpadding="10" cellmargin="5" border="1">
<tr>
<th>id_producto</th>
<th>nombre_producto</th>
<th>descripcion_producto</th>
<th>precio_producto</th>
<th>fecha_producto</th>
</tr>
<?php
foreach($model as $row)
{
echo "<tr>";
echo "<td>".$row['id_producto']."</td>";
echo "<td>".$row['nombre_producto']."</td>";
echo "<td>".$row['descripcion_producto']."</td>";
echo "<td>".$row['precio_producto']."</td>";
echo "<td>".$row['fecha_producto']."</td>";
echo "</tr>";
}
?>
</table>
<br>
<br>
<style>
/* CSS */
.btn
{
text-decoration: none;
color: #FFFFFF;
padding-left: 10px;
padding-right: 10px;
margin-left: 1px;
margin-right: 1px;
border-radius: 3px;
background: #7F83AD;
}

.btn:hover
{
background: #474C80;
}
.active
{
background: #E7814A;
}
/* CSS */
</style>
<div>
<?php
$pagination->pages("btn");
?>
</div>
</center>
<br>

<br>
<br>
<br>
</body>
</html>


ayuda porfavor aconectarlaaa y poder ver los cambios o transacciones en la paginaaa realll