Prechádzať zdrojové kódy

arreglo productos.php

david 12 rokov pred
rodič
commit
8af08558fe
2 zmenil súbory, kde vykonal 13 pridanie a 13 odobranie
  1. 4 5
      css/productos.css
  2. 9 8
      listaprod.php

+ 4 - 5
css/productos.css

@@ -55,9 +55,7 @@ margin-top: 50px;
 }
 
 /*************LISTA PRODUCTOS************/
-.producto {
-width: 50%;
-}
+.producto {width: 50%;float:left;}
 
 #productosbar
 {
@@ -99,7 +97,7 @@ width: 50%;
 	display: table;
 }
 
-.listaproductos{display:inline-flex; width:100%;}
+.listaproductos{padding-bottom:10px; width:100%;}
 
 .imagen{
 	margin-top: 2%;
@@ -107,6 +105,7 @@ width: 50%;
 	display: inline-block;
 	text-align: center;
 	width: 25%;
+	float: left;
 }
 
 .texto{ 
@@ -114,5 +113,5 @@ width: 50%;
 	color: #465A68;
 	display: inline-block; 
 	width: 70%; 
-	margin-top:30px;
+	float:left;
 }

+ 9 - 8
listaprod.php

@@ -2,23 +2,24 @@
 <?php
 include('db.php');
 
-$statement = $db->prepare("SELECT p.nombre, d.desc_corta, d.descripcion
+if (!$statement = $db->prepare("SELECT p.idproducto,p.nombre, d.desc_corta
 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'];
+WHERE c.nombre = ? AND c.idioma = 'espanol' ")) {
+die('error!!!');
 }
+$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);
+$statement->bind_result($id,$nombre,$desc);
 $count=$statement->num_rows;
 $i=0;
 $pag=0;
 
+if ($count > 6) echo "<div id='flechaatras'><!--imagen--></div>";
 while ( $statement->fetch() ) {
     $i++;
     if (($i-1) % 6 == 0  && $i > 1 || $i == 1) {
@@ -31,12 +32,12 @@ while ( $statement->fetch() ) {
                     <img src='Images/producto.jpg'>
                 </div>
                 <div class='texto'>
-                    <h5>$nombre</h5><br>$desc<br><br><u>Ver más</u>
+                    <h5>$nombre</h5><br>$desc<br><br><u prodid='$id'>Ver más</u>
                 </div>
            </div>";
     echo $html;
 	if($i % 2 == 0) { echo "</div>"; } # listaproductos
     if($i % 6 == 0) { echo "</div>"; } #pagina 
 }
+if ($count > 6) echo "<div id='flechafwd'><!--imagen--></div>";
 ?>
-