Foros del Web » Programando para Internet » PHP »

actualizar registros con php (mysql)

Estas en el tema de actualizar registros con php (mysql) en el foro de PHP en Foros del Web. Hola A Todos los que me lean... tengo el siguiente problema... mi web es php y mysql y no soy muy experto en el tema ...
  #1 (permalink)  
Antiguo 11/03/2015, 17:20
 
Fecha de Ingreso: mayo-2014
Ubicación: valparaiso, chile
Mensajes: 34
Antigüedad: 10 años
Puntos: 0
actualizar registros con php (mysql)

Hola A Todos los que me lean...
tengo el siguiente problema...
mi web es php y mysql y no soy muy experto en el tema ...
quiero recibir por get y luego actualizar por post las peliculas de mi web...
he buscado códigos en Internet para solucionar mi problema pero no he encontrado la solucion...
los codigos son estos:
Código PHP:
<?php
require_once('../../Connections/conexion.php');
 
?>
 <?php 
 
//definir database
 
mysql_select_db($database_pelislatinofinal,$pelislatinofinal) or die ("no se pudo conectar");
 
?>
<?php 
if ( !empty($_GET['editar']) ) {
// traemos la pelicula
$query "SELECT * FROM `tbltodaslaspelis` WHERE idPelicula = {$_GET['editar']} limit 1";
$response mysql_query($query$pelislatinofinal);
$noticia mysql_fetch_assoc($response);
?>
----------------------
Código PHP:
 if ( !empty($_POST['submit']) ) {
$query mysql_query ("UPDATE tbltodaslaspelis set ('$_POST[Nombre]','$_POST[Imagen]','$_POST[Sinopsis]','$_POST[Info]','$_POST[Online]','$_POST[Trailer]','$_POST[Links]','$_POST[Tags]' WHERE '$_POST[idPelicula]') LIMIT 1");
$response mysql_query($query$pelislatinofinal);

-------------------


y este es el formulario de la actualizacion (lei que habia que agregar el id en un campo oculto para poder actualizar

Código PHP:
<script>
function subirimagen()
{
        self.name = 'opener';
        remote = open('gestionimagen.php', 'remote',
        'width=400,heighht=150,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,fullscreen=no, status=yes');
        remote.focus();
        }
    
    </script>
  <p>Editar pelicula:</p>
  <form id="form2" name="form2" method="POST" action="lista_all.php">
    <table width="405" border="1">
      <tr>
        <td width="127">Nombre</td>
        <td width="262"><label for="Nombre"></label>
          <input name="Nombre" type="text" id="Nombre" value=" <?php echo $noticia['Nombre']; ?>" /></td>
      </tr>
      <tr>
        <td>Imagen</td>
        <td><label for="Imagen"></label>
          <input type="text" name="Imagen" value="<?php echo $noticia['Imagen']; ?>" size="25" />
          <input type="button" name="button" id="button" value="Subir Imagen" onclick="javascript:subirimagen();"/></td>
      </tr>
      <tr>
        <td>Sinopsis</td>
        <td><label for="Sinopsis"></label>
          <input name="Sinopsis" type="text" id="Sinopsis" value="<?php echo $noticia['Sinopsis']; ?>" /></td>
      </tr>
      <tr>
        <td>Info</td>
        <td><label for="Info"></label>
          <textarea name="Info" id="Info" value="" cols="45" rows="5"><?php echo $noticia['Info']; ?></textarea></td>
      </tr>
      <tr>
        <td>Peli Online</td>
        <td><label for="Online"></label>
          <input name="Online" type="text" id="Online" value="<?php echo $noticia['Online']; ?>" /></td>
      </tr>
      <tr>
        <td>Trailer</td>
        <td><label for="Trailer"></label>
          <input name="Trailer" type="text" id="Trailer" value="<?php echo $noticia['Trailer']; ?>" /></td>
      </tr>
      <tr>
        <td>Links</td>
        <td><label for="Links"></label>
          <textarea name="Links" id="Links" cols="45" rows="5"><?php echo $noticia['Links']; ?></textarea></td>
      </tr>
      <tr>
        <td>Tags</td>
        <td><label for="Tags"></label>
          <textarea name="Tags" id="Tags" cols="45" rows="5"><?php echo $noticia['Tags']; ?></textarea></td>
      </tr>
      <tr>
        <td colspan="2"><input type="submit" name="button" id="button" value="Actualizar" /></td>
        </tr>
    </table>
    <input name="idPelicula" type="hidden" id="idPelicula" value="<? echo $noticia['idPelicula']; ?>" />
  </form>
-----------------------------------------------------
espero que alguien me pueda ayudar.. desde ya muchas gracias

Etiquetas: formulario, mysql, registros, select
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:27.