Tema: Oracle y php
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/11/2012, 11:15
asera
 
Fecha de Ingreso: octubre-2012
Mensajes: 1
Antigüedad: 11 años, 6 meses
Puntos: 0
Oracle y php

Hola buen día!!, soy nueva en esto de la programación en Oracle y php, mi problema es el siguiente:
tengo este código que me muestra los datos que tengo almacenados en mi bd:
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  4. <title>Centros de Trabajo-RCCL</title>
  5. </head>
  6. <?PHP
  7. include("encabezado.php");
  8. include("menu.html");
  9. include("conectar.php");
  10.    //Declaración de sentencia SQL para seleccionar los datos
  11.     $stid = oci_parse($conn, 'select * from TBLCENTROTRABAJO order by PKNCENTROTRABAJO');
  12.      //Ejecuta la sentencia SQL
  13.       oci_execute($stid);
  14.        //Saltos de línea
  15.        echo "<br />";
  16.         echo "<br />";
  17.         echo "<br />";
  18.         echo "<br />";
  19.          //Creación de la tabla para mostrar los datos
  20.           echo "<table width=1101 border=1 align=center>";
  21.           echo "<tr>";
  22.           echo "<td colspan=3><div align=center>ACCION</div></td>";
  23.           echo "<td width=170><div align=center>CENTRO DE TRABAJO</div></td>";
  24.           echo "<td width=515><div align=center>NOMBRE LARGO</div></td>";
  25.           echo  "<td width=301><div align=center>NOMBRE CORTO</div></td>";
  26.             echo "</tr>";
  27.            //Creación de arreglo y condición de para que los datos sean en mayúsculas
  28.               while (($row = oci_fetch_array($stid, OCI_BOTH))) {
  29.             //Parte de la tabla que contiene los botones para realizar la acción de nuevo,modificar y eliminar
  30.               echo "<tr>";
  31.             echo "<form id=form1 name=form1 method=post action=Ncentrotrabajo1.php>";
  32.             echo "<td><input type=submit name=Submit value=Nuevo></td>";
  33.             echo "</form>";
  34.             echo "<form id=form1 name=form1 method=post action=1.php>";
  35.             echo "<td><input type=submit name=Submit value=Modificar></td>";
  36.             echo "</form>";
  37.             echo "<form id=form1 name=form1 method=post action=2.php>";
  38.             echo "<td><input type=submit name=Submit value=Eliminar></td>";
  39.             echo "</form>";
  40.              //Imprime los datos contenidos en la base de datos
  41.              echo "<td><div align=center>";
  42.              echo $row[0];
  43.              echo "</div></td>";
  44.              echo "<td><div align=center>";
  45.              echo $row[1];
  46.              echo "</div></td>";
  47.              echo "<td><div align=center>";
  48.              echo $row[2];
  49.              echo "</div><tr>";
  50.              echo "</td>";
  51.            }//Fin del arreglo y de la condición para imprimir en mayúsculas
  52.          //Cierre de la tabla
  53.          echo "</table>";
  54.      //Liberación de recursos recibidos del resultado de oci_parse()
  55.      oci_free_statement($stid);
  56. //Cierre de la conexión
  57. oci_close($conn);
  58. ?>
  59. </body>
  60. </html>

Lo que necesito hacer es que al oprimir el botón borrar me borre el dato
mi código de eliminar es el siguiente
Código MySQL:
Ver original
  1. <?PHP
  2. session_start();
  3. //Se establece la conexion con la base de datos
  4. include("conectar.php");
  5. $var1 = $_POST[$row[0]];
  6. $stid = oci_parse($conn, "delete from TBLCENTROTRABAJO where PKNCENTROTRABAJO='$var1'");
  7.    $result=oci_execute($stid);
  8.  
  9.         //Ejecutar la sentencia para insertar    
  10.         if ($result){
  11.         echo "<script> alert ('¡FILA eliminada EXITOSAMENTE!');
  12.         </script>";
  13.         echo "<meta http-equiv='refresh' content='0; url=Mcentrotrabajo.php'>";
  14.         }
  15.         else{
  16.         echo "<script> alert ('¡ERROR AL eliminar EL NUEVO DATO!');
  17.         </script>";
  18.          echo "<meta http-equiv='refresh' content='0; url=Mcentrotrabajo.php'>";
  19.         }
  20. //liberación        
  21. oci_free_statement($stid);
  22. //Cierre de la conexión
  23. oci_close($conn);
  24. ?>
pero no me borra el dato, porfavor espero me ayuden,me urge

Última edición por gnzsoloyo; 08/11/2012 a las 21:11 Razón: Sin etiquetar.