Tema: Php a Asp
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/02/2015, 04:46
jorgepallol1
 
Fecha de Ingreso: noviembre-2013
Ubicación: Madrid
Mensajes: 3
Antigüedad: 10 años, 6 meses
Puntos: 0
Php a Asp

Quiero hacer una preesentacion en jsp de una select.
Pero quiero presentarla asi.
En cada Celda quiero un registro, que se vea en una tabla un total de x
registros (paguinacion incluida).

El codigo lo he encontrado en Php, pero no se como presentarlo en jsp

Pido ayuda por favor


//CODIGO DE PHP

Código PHP:
Ver original
  1. <?PHP
  2.         $objConnect = mysql_connect("localhost","root","") or die(mysql_error());
  3.         $objDB = mysql_select_db("otaku");
  4.        
  5.         $strSQL = "SELECT *FROM serie";
  6.  
  7.         $objQuery = mysql_query($strSQL);
  8.         $Num_Rows = mysql_num_rows($objQuery);
  9.  
  10.         $Per_Page = 8;   // Per Page
  11.  
  12.         @$Page = $_GET["Page"];
  13.         if(!@$_GET["Page"])
  14.         {
  15.             $Page=1;
  16.         }
  17.  
  18.         $Prev_Page = $Page-1;
  19.         $Next_Page = $Page+1;
  20.  
  21.         $Page_Start = (($Per_Page*$Page)-$Per_Page);
  22.         if($Num_Rows<=$Per_Page)
  23.         {
  24.             $Num_Pages =1;
  25.         }
  26.         else if(($Num_Rows % $Per_Page)==0)
  27.         {
  28.             $Num_Pages =($Num_Rows/$Per_Page) ;
  29.         }
  30.         else
  31.         {
  32.             $Num_Pages =($Num_Rows/$Per_Page)+1;
  33.             $Num_Pages = (int)$Num_Pages;
  34.         }
  35.  
  36.         $strSQL .=" order  by id_serie ASC LIMIT $Page_Start , $Per_Page";
  37.         $objQuery  = mysql_query($strSQL);
  38.  
  39.  
  40.         echo"<table border=\"0\" width=\"50%\" align=\"center\" cellspacing=\"1\" cellpadding=\"1\"><tr>";
  41.         $intRows = 0;
  42.         while($objResult = mysql_fetch_array($objQuery))
  43.         {
  44.             echo "<td>";
  45.             $intRows++;
  46.     ?>
  47. <center><img with="150" height="150" src="http://www.forosdelweb.com/f45/php-asp-1120414/..\<?=$objResult["imagen_principal"]; ?>"><br>
  48.   </br>
  49.  <span class="titulo"> <?=$objResult["Nombre"];?></span>
  50.  
  51.   </br>
  52.    <span class="pequeño"><?=$objResult["Descripcion_p"];?></span><br />
  53. </center>
  54.  
  55.   <?php        
  56. echo"<a href=\"eliminarserie.php?inombre='".$objResult['id_serie']."'\">ELIMINAR</a>
  57.    
  58.     <a href=\"updateserie.php?inombre='".$objResult['id_serie']."'\">UPDATE</a>
  59. <a href=\"fichaserie.php?inombre='".$objResult['id_serie']."'\">FICHA</a>";?>
  60.   <?PHP
  61.             echo"</td>";
  62.             if(($intRows)%4==0)
  63.             {
  64.                 echo"</tr>";
  65.             }
  66.         }
  67.         echo"</tr></table>";
  68.     ?>
  69.  
  70.   <br>
  71.   <span class="paguinas">Total
  72.   <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :</span>
  73.  
  74.   <?PHP
  75.         if($Prev_Page)
  76.         {
  77.             echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
  78.         }
  79.  
  80.         for($i=1; $i<=$Num_Pages; $i++){
  81.             if($i != $Page)
  82.             {
  83.                 echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
  84.             }
  85.             else
  86.             {
  87.                 echo "<b> $i </b>";
  88.             }
  89.         }
  90.         if($Page!=$Num_Pages)
  91.         {
  92.             echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
  93.         }
  94.         ?>
  95.  
  96.   <?PHP
  97. mysql_close($objConnect);
  98. ?> <br />
  99.   <a href="serie.php">INSERTAR NUEVO REGISTRO<br />
  100.   <a href="listar_galerias.php">Galerias
  101.   </a></p>
  102. </body>
  103. </html>

Última edición por razpeitia; 10/02/2015 a las 22:10