Ver Mensaje Individual
  #5 (permalink)  
Antiguo 01/07/2008, 21:29
rhpino
 
Fecha de Ingreso: junio-2008
Mensajes: 25
Antigüedad: 16 años, 7 meses
Puntos: 0
Respuesta: como mostrar datos y modificarlos.......

ejemplo funcional, lo sake de una web que toi arregando asi que si le sirve..uselo nomas cumpa.

los "if" estan para que lo que se necesita solo si se hace algo en particular.



Código PHP:
//guardar noticia editara

if($_GET["editnoticia"]==2 ){ // guardar entre comillas ;)

if (isset($_POST[somos])   && $_POST[somos]!="") {


$result=mysql_query("UPDATE noticias SET texto='$_POST[somos]' WHERE `Id`='$_POST[id]' LIMIT 1 ");
echo"

<h3>Los registros han sido actualizados</h3><br>";

} else { echo "Dejaste vacía la noticia"; } }

// fin guardar noticia editada
            
// editar noticia    



        
            
if($_GET['editnoticia']==1)
        {
        
        $result=mysql_query("SELECT * FROM noticias WHERE `Id`='$_GET[id]' LIMIT 1");
$row = mysql_fetch_array($result);
?>

<form action="<?php echo $PHP_SELF?>?editnoticia=2" method="POST">
<table width="35%" border="0" cellspacing="3" cellpadding="0">
  <tr>
    <td><p>
    </p>
      <p>
        <label>
        <input name="id" type="hidden" value="<?= $row[Id?>">
        <textarea name="somos" cols="100" rows="80"><?= $row[texto?></textarea>
        </label>
</p></td>
    </tr>
  <tr>
    <td>      <div align="center">
      <input name="submit" type="submit" value="Guardar">
        </div></td>
    </tr>
</table>

</form>
<?
        
        
        
        
}            
            
            
//fin editar not