Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/01/2007, 13:59
mvlsistemas
 
Fecha de Ingreso: mayo-2004
Mensajes: 903
Antigüedad: 20 años
Puntos: 4
que les parece? editar borrar y mostrar registros en tablas

Hola lo postee en dos porque es largo, es un script pata ingresar mostrar editar y borrar registros de una web de hoteles, lo hice usando script de maestros del web, el paginaitor de pinedo y vs ayudas de ustedes claro está-

mostrar.php
Código PHP:
<?php include("cone.php"); ?>
<?php

$_pagi_sql 
=("SELECT hotel,estrellas,vigencia,sgl,dbl,tpl,suite,cama,adicional,htm from paquetes WHERE web ='at_web'order by hotel Asc");
//cantidad de resultados por página (opcional, por defecto 20)
$_pagi_cuantos 20
//Incluimos el script de paginación. Éste ya ejecuta la consulta automáticamente
include("paginator.inc.php");
echo 
'<table width="580" border="0" bgcolor="#993366" cellpadding="0" cellspacing="0" >';
echo
'
  <tr height="25"> 
    <td width="150" align="left"><strong><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">Argentina</font></strong></td>
    <td height="20" width="10" align = "left" > 
     <strong> 
     <font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">*</font></strong></td>
    <td width="100"  align="center"><strong><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">Vigencia</font></strong></td>
    <td width="30"align="center"><strong><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">SGL</font></strong></td>
    <td width="30" align="center"><strong><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">DBL</font></strong></td>
    <td width="30" align="center"><strong><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">TPL</font></strong></td>
    <td width="30" align="center"><strong><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">SUITE</font></strong></td>
    <td width="30" align="center"><img src="iconocama.gif" width="19" height="20"></td>
    <td width="80" align="lcenter"><strong><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">ADICIONAL</font></strong></td>
    <td width="30" align="center"><strong><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif">Fotos</font></strong></td>
  </tr>'
// Así escribimos la cabecera de la tabla
while ($row mysql_fetch_array($_pagi_result)) { 

if (
$colorfila==0){
       
$color"#F4EACA";
       
$colorfila=1;
    }else{
       
$color="#FFFFE6";
       
$colorfila=0;
    }

 echo 
'<tr bgcolor='.$color.'>''<td  height="20" width="150" height="4" >'.'<strong>'.$row['hotel'].'</td>'.'</strong>'.'<td height="20" width="10" align = "left" >'.'<strong>'.$row['estrellas'].'</td>'.'</strong>'.'<td width="100"  align = "center" >'.'<strong>'.$row['vigencia'].'</td>'.'</strong>'.'<td height="20" width="30" align = "center" >'.'<strong>'.$row['sgl'].'</td>'.'</strong>'.'<td height="20" width="30"  align = "center" >'.'<strong>'.$row['dbl'].'</td>'.'</strong>'.'<td height="20" width="30" align = "center" >'.'<strong>'.$row['tpl'].'</td>'.'</strong>'.'<td width="30"  align = "center" >'.'<strong>'.$row['suite'].'</td>'.'</strong>'.'<td height="20" width="30" align = "center" >'.'<strong>'.$row['cama'].'</td>'.'</strong>'.'<td height="20" width="80" align="center">'.'<strong>'.$row['adicional'].'</td>'.'</strong>'.'<td height="20"width="30" align ="center">'.$row['htm'].'</td>'.'</tr>';

}

echo 
'</table>'// Fin de la tabla.
echo"<p>".$_pagi_navegacion."</p>";
?>
editar.php
Código PHP:
<?php include("cone.php"); ?>
<?php 
    
//recibimos la variable id enviada en el enlace por GET 
    
$id=$_GET[id]; 
    
//hacemos las consultas 
    
$result=mysql_query("select * from paquetes where id_web='$id'",$connect); 
    
//Una vez seleccionados los registros los mostramos para su edición 
    
echo '<table width="500" border="0" cellpadding="0" cellspacing="0" >';
    while(
$row=mysql_fetch_array($result)){ 
echo 
'<form action="edit.php" method="post"><input type="hidden" name="id" value="'.$row[id_web].'"> 
 <tr height="24" >
   <td><font color="#FFFFFF"><strong>WEB</strong></font></td>
    </tr>
 <tr>
     <td>
     <input type="text" size="15" name="web" value="'
.$row[web].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
      </tr>
<tr bgcolor="#983977" height="24"> 
 <td><font color="#FFFFFF"><strong>PROVINCIA</strong></font></td>
    <td><font color="#FFFFFF"><strong>CIUDAD</strong></font></td>
    <td><font color="#FFFFFF"><strong>PAIS</strong></font></td>
  </tr>
  <tr> 
  <td>
    <input type="text" size="15" name="provincia" value="'
.$row[provincia].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
    <td>
    <input type="text" size="15" name="ciudad" value="'
.$row[ciudad].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
    <td>
    <input type="text" size="15" name="pais" value="'
.$row[pais].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
  </tr>
  <tr bgcolor="#983977" height="24"> 
    <td height="25" ><font color="#FFFFFF"><strong>HOTEL</strong></font></td>
    <td ><font color="#FFFFFF"><strong>ESTRELLAS:</strong></font></td>
    <td ><font color="#FFFFFF"><strong>VIGENCIA:</strong></font></td>
  </tr>
  <tr> 
    <td>
    <input type="text" size="15" name="hotel" value="'
.$row[hotel].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
    <td>
    <input type="text" size="15" name="estrellas" value="'
.$row[estrellas].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
    <td>
    <input type="text" size="15" name="vigencia" value="'
.$row[vigencia].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
  </tr>
  <tr bgcolor="#983977" height="24"> 
    <td><font color="#FFFFFF"><strong>SGL: </strong></font></td>
    <td><font color="#FFFFFF"><strong>DBL </strong></font></td>
    <td><font color="#FFFFFF"><strong>TPL: </strong></font></td>
  </tr>
  <tr bgcolor="#983977" > 
    <td>
    <input type="text" size="15" name="sgl" value="'
.$row[sgl].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
    <td>
    <input type="text" size="15" name="dbl" value="'
.$row[dbl].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
    <td>
    <input type="text" size="15" name="tpl" value="'
.$row[tpl].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
  </tr>
  <tr bgcolor="#983977" height="24"> 
    <td><font color="#FFFFFF" size="1"><strong>SUITE:</strong></font></td>
    <td><font color="#FFFFFF"><strong>CAMA: </strong></font></td>
    <td><font color="#FFFFFF"><strong>ADICIONAL: </strong></font></td>
  </tr>
  <tr> 
    <td>
    <input type="text" size="15" name="suite" value="'
.$row[suite].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
    <td>
    <input type="text" size="15" name="cama" value="'
.$row[cama].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>
    <td>
    <input type="text" size="15" name="adicional" value="'
.$row[adicional].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1"></td>  </tr>
    <tr height="24" ><td colspan="3">
   <font color="#FFFFFF"><strong>HTM:</strong></font>
    </td></tr>
 <tr><td colspan="3">
     <input type="text" size="15" name="htm" value="'
.$row[htm].'" style="font-family: Arial; font-size: 10pt; border-style: solid; border-width: 1">
      </td></tr>
    </table>
<tr align="right"><td height="40">
  <p align="center">
  <input type="submit" value="Editar" style="font-family: Arial; font-size: 8pt; font-weight: bold"></td> </tr>
</form>'


mysql_free_result($result); 
mysql_close($connect); 
?>

Última edición por mvlsistemas; 18/01/2007 a las 08:14 Razón: cambio de titulo