Documentos de Académico
Documentos de Profesional
Documentos de Cultura
PHP y Oracle PDF
PHP y Oracle PDF
$res['SALARIO'];
INSERCIN DE UNA FILA EN EMPLE, BORRADO DE FILAS Y USO DE UNA FUNCIN PARA LISTAR EMPLEADOS:
<?php
function listar_emple($dep) {
$conexion = oci_connect("system","oracle",'xe');
$query = "SELECT * FROM EMPLE WHERE DEPT_NO= $dep";//NO PONER ; EN SENTENCIA SQL
$s = oci_parse($conexion , $query );
oci_execute($s);
$i =0;
while ($res= oci_fetch_array($s, OCI_ASSOC))
{
echo $res['EMP_NO'] . "*" . $res['APELLIDO'] . "*" . $res['OFICIO']
. "*" . $res['SALARIO'] ;
echo "<br/>";
$i= $i+1;
} // fin while
echo "<hr/>";
}//fin de la funcin de listado
//INSERCION DE DATOS EN EMPLE ----------------------------------------------------$conexion = oci_connect("system","oracle",'xe');
$E =1236;
$APE='LOPEZ';
$D=10;
$OFI='EMPLEADO';
$SAL=1500;
$query = "INSERT INTO EMPLE (EMP_NO,APELLIDO, OFICIO, SALARIO,DEPT_NO) VALUES ($E, '$APE',
'$OFI', $SAL, $D) ";
$s = oci_parse($conexion , $query );
oci_execute($s);
$numero=oci_num_rows($s);
echo "Filas insertadas: " . $numero . "<br/><hr/>";
//ELIMINACION EN EMPLE -------------------------------------------------------------$E =1236; //empleado a borrar
$query = "DELETE EMPLE WHERE EMP_NO = $E ";
$s = oci_parse($conexion , $query );
oci_execute($s);
$numero=oci_num_rows($s);
echo "Filas eliminadas: " . $numero . "<br/><hr/>";
listar_emple($D); //llamada a la funcin
oci_close($conexion);
?>
http://www.php-es.com/ref.oci8.html
http://www.phpwelt.net/handbuecher/spanish/ref.oci8.html
http://www.phpwelt.net/handbuecher/spanish/function.oci-fetch-array.html