Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/04/2012, 06:11
carolina3
 
Fecha de Ingreso: agosto-2011
Ubicación: barcelona
Mensajes: 237
Antigüedad: 12 años, 9 meses
Puntos: 1
mostrar ultimo registro en repetir region

hola muy buenas tengo un problema a la hora de introducir una serie de imágenes en mi web, he creado un juego de registros donde coloco una serie de productos (las imágenes) pero conforme voy introduciendo me gustaría que se introdujeran el ultimo introducido el primero y no al revés como me sucede ahora y no se como cambiar esto alguien tiene alguna idea de que parámetro cambiar.
gracias

aquí el código:


Código PHP:
Ver original
  1. if (!function_exists("GetSQLValueString")) {
  2. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  3. {
  4.   if (PHP_VERSION < 6) {
  5.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  6.   }
  7.  
  8.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  9.  
  10.   switch ($theType) {
  11.     case "text":
  12.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  13.       break;    
  14.     case "long":
  15.     case "int":
  16.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  17.       break;
  18.     case "double":
  19.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  20.       break;
  21.     case "date":
  22.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  23.       break;
  24.     case "defined":
  25.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  26.       break;
  27.   }
  28.   return $theValue;
  29. }
  30. }
  31.  
  32. $maxRows_listadoproductos = 4;
  33. $pageNum_listadoproductos = 0;
  34.  
  35. if (isset($_GET['pageNum_listadoproductos'])) {
  36.   $pageNum_listadoproductos = $_GET['pageNum_listadoproductos'];
  37. }
  38. $startRow_listadoproductos = $pageNum_listadoproductos * $maxRows_listadoproductos;
  39.  
  40.  
  41. $maxRows_listadoproductos = 6;
  42. $pageNum_listadoproductos = 0;
  43. if (isset($_GET['pageNum_listadoproductos'])) {
  44.   $pageNum_listadoproductos = $_GET['pageNum_listadoproductos'];
  45. }
  46. $startRow_listadoproductos = $pageNum_listadoproductos * $maxRows_listadoproductos;
  47.  
  48. mysql_select_db($database_blueberryswebtiendas, $blueberryswebtiendas);
  49. $query_listadoproductos = "SELECT * FROM productos WHERE tienda = '$nombre'";
  50. $query_limit_listadoproductos = sprintf("%s LIMIT %d, %d", $query_listadoproductos, $startRow_listadoproductos, $maxRows_listadoproductos);
  51. $listadoproductos = mysql_query($query_limit_listadoproductos, $blueberryswebtiendas) or die(mysql_error());
  52. $row_listadoproductos = mysql_fetch_assoc($listadoproductos);
  53.  
  54. if (isset($_GET['totalRows_listadoproductos'])) {
  55.   $totalRows_listadoproductos = $_GET['totalRows_listadoproductos'];
  56. } else {
  57.   $all_listadoproductos = mysql_query($query_listadoproductos);
  58.   $totalRows_listadoproductos = mysql_num_rows($all_listadoproductos);
  59. }
  60. $totalPages_listadoproductos = ceil($totalRows_listadoproductos/$maxRows_listadoproductos)-1;




Código PHP:
Ver original
  1. <table width="200" height="173" border="0" align="right">
  2.   <?php
  3.  
  4.   $cuantos=0;
  5.   do{
  6.   if ($cuantos == 0){
  7.  
  8.   ?>
  9.  
  10.   <tr>
  11.         <?php
  12.   }
  13.   $cuantos ++;
  14.   ?>
  15.        
  16.         <td width="200" align="center" valign="middle"><p><a href="detalle_producto.php?producto_id=<?php echo $row_listadoproductos['producto_id']; ?>">
  17.          
  18.           <!--llamaremos a la pagina miniatura_productos para que las imagenes se vean en pequeño y detalle a diferentes medidas-->  
  19.           <?php
  20.        
  21.         $nombre2=$row_listadoproductos['foto_producto'];
  22.         $nombre2= "miniatura_producto.php?nombre=productos/" . $nombre2;
  23.        
  24.        
  25.        
  26.         ?>
  27.           </a>  
  28.                
  29.          
  30.          
  31.          
  32.           <p><a href="detalle_producto.php?producto_id=<?php echo $row_listadoproductos['producto_id']; ?>"> <img src="<?php echo $nombre2; ?>" width="134" height="91" /></a><?php echo $row_listadoproductos['nombre_producto']; ?><br />
  33.             <a href="detalle_producto.php?producto_id=<?php echo $row_listadoproductos['producto_id']; ?>">+ detalle</a>
  34.           <p class="precio"><?php echo $row_listadoproductos['precio_producto']; ?> €</p>
  35.           <form id="form1" name="form1" method="post" action="carrito_compra.php">
  36.             <input name="cantidad" type="hidden" id="cantidad" value="1" />
  37.             <input name="precio" type="hidden" id="precio" value="<?php echo $row_listadoproductos['precio_producto']; ?>" />
  38.             <input name="nombre" type="hidden" id="nombre" value="<?php echo $row_listadoproductos['nombre_producto']; ?>" />
  39.             <input type="image" name="imageField" id="imageField" src="imagenes/botones/btncestacompra.png"/>
  40.           </form></td>
  41.        
  42.         <?php  
  43.   //este numero del if de la variable cuantos es el numero de filas que queremos
  44.    if ($cuantos == 3){
  45.    $cuantos =0;
  46.   ?>    
  47.       </tr>
  48.       <?php
  49.    }
  50.    ?>
  51.      
  52.      
  53.  
  54.     <?php } while ($row_listadoproductos = mysql_fetch_assoc($listadoproductos)); ?>
  55.       </table>