| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- include('db.php');
- $statement = $db->prepare("SELECT p.nombre, d.desc_corta, d.descripcion
- FROM productos p
- left join descripcion d on p.idproducto = d.idproducto
- left join categorias c on c.idcategoria = p.categoria
- WHERE c.nombre = ? AND c.idioma = 'espanol' ");
- $cat = 'Limpieza';
- if (isset($_GET['cat'])) {
- $cat = $_GET['cat'];
- }
- $statement->bind_param('s', $cat);
- $statement->execute();
- $statement->store_result();
- $statement->bind_result($nombre,$desc,$descripcion);
- $count=$statement->num_rows;
- /* var productos = [] ;
- $.each(prod, function(i, item) {
- var proddiv = $('<div/>', {
- class: 'producto',
- html: item['html']
- });
- var img = "Images/producto.jpg";
- productos.push(proddiv);
- });
-
-
- var lista_prod = $('<div/>', {
- id: 'lista_productos',
- html: productos
- });
- var pagina = $('<div/>', {
- id: 0, //incrementar
- class: 'pagina',
- html: lista_prod
- });
- */
- $i=0;
- $pag=0;
- while ( $statement->fetch() ) {
- if (($i-1) % 6 && $i > 2 || $i == 0) {
- echo "<div class='pagina' id='pagina-$pag'>\n";
- $pag++;
- }
- if(($i-1) % 2 && $i > 2 || $i == 0){
- echo "<div class='listaproductos'>\n";
- }
- $html ="<div class='imagen'>
- <img src='Images/producto.jpg'>
- </div>
- <div class='texto'>
- <h5>$nombre</h5><br>$desc<br><br><u>Ver más</u>
- </div>";
- echo $html;
- if($i % 2)
- {
- echo "</div>";
- }
-
- if ($i % 6) {
- echo "</div>"; //pagina
- //echo "</div>"; //listaprod
- }
- $i++;
- }
- ?>
|