Ver Mensaje Individual
  #14 (permalink)  
Antiguo 26/06/2013, 22:34
josue07pearl
 
Fecha de Ingreso: junio-2013
Mensajes: 33
Antigüedad: 10 años, 10 meses
Puntos: 0
Respuesta: Actualizacion

SI hiva a postear el codigo solo que en ese momento no tenia el codigo a la mano pero aqui esta asi tendria que hacer el procedimiento.



Código PHP:
Ver original
  1. <?php
  2. /** conexion ***************************/
  3. // conectamos a la base de datos
  4. include ("scripts/fconectar.php");
  5. $conexion= conectarse();
  6. $idregion = $_POST['id'];
  7. $nombreg = $_POST['region'];
  8.  
  9.     $sql =mysql_query("SELECT * from regiones where id_n= '$idregion' and id_region ='$nombreg' ", $conexion);
  10.     $row = mysql_fetch_array($sql);
  11.     $nomb=$row[1];
  12.                 echo "<br>";echo "<br>";
  13.     $row1 =  mysql_affected_rows();//sentencia para verificar si esafectada una fila
  14.     if ($row1==0 and $nomb!=='$nombreg'){
  15.                 $mensaje =  "Registro ya existe";
  16.     $msg="<a href=\"regionbusqueda.php\"> Click aqui para regresar</a>";
  17.                     echo "<br> \n";
  18.    
  19.                     </div>";
  20.                     echo "<p style='text-align:center'>".$mensaje."</p>";
  21.                     echo "<p style='text-align:center'>".$msg."</p>";
  22.  
  23.                
  24.     }
  25.     else
  26.     {
  27.         $sqlUpdate = mysql_query("UPDATE regiones SET id_region = '$nombreg' WHERE id_n = '$idregion'", $conexion);
  28.                 $mensaje =  "Registro Actualizado";
  29.                 $msg="<a href=\"regionbusqueda.php\"> Click aqui para regresar</a>";
  30.         </div>";
  31.                     echo "<p style='text-align:center'>".$mensaje."</p>";
  32.                     echo "<p style='text-align:center'>".$msg."</p>";
  33.     }
  34. ?>