Ver Mensaje Individual
  #3 (permalink)  
Antiguo 04/11/2005, 07:40
magarca85
 
Fecha de Ingreso: noviembre-2005
Mensajes: 4
Antigüedad: 18 años, 5 meses
Puntos: 0
Muchisimas gracias Cluster, eres mi idolo.

Todo lo que parece un mundo para mi, en un segundo me lo has solucionado y yo he estado 2 semanas dandole vueltas, leyendo y comentandoselo a todo el mundo, y no conseguia nada.

Espero algun dia poder estar a tu altura, aunque es muy dificil.

Un besazo

Cuelgo el codigo con todo modofocado por si a alguien le puede interesar.

Código PHP:
<?Php
  
require("aut_verifica.inc.php");
   
$nivel_acceso=3// Nivel de acceso para esta página.
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<style>

a{text-decoration:none}
a:hover{color:black}
}
BODY {
    SCROLLBAR-FACE-COLOR: #309EB6; SCROLLBAR-HIGHLIGHT-COLOR: #309EB6; SCROLLBAR-SHADOW-COLOR: #FFFFFF; SCROLLBAR-3DLIGHT-COLOR: #FFFFFF; SCROLLBAR-ARROW-COLOR: #FFFFFF; SCROLLBAR-TRACK-COLOR: #309EB6; SCROLLBAR-DARKSHADOW-COLOR: orange;
}
</style>


<head>
<title> Imprimir Gases / Modificar </title>

<script language="JavaScript">
<!--

function confirmar(Id) {
    var respuesta = confirm('Esta seguro de eliminar el precio del gas?');
    if (respuesta == true) {
                    alert('Si estoy seguro');
                window.location.href = "BorrarPrecioGas.php?accion=borrar&id="+Id;
    } else {
        alert('No deseo cancelarlo ....');
        window.location.href = "BorrarPrecioGas.php?accion=no";
    }
}


//-->
</script>

</head>

<body bgcolor="#309EB6" text="#309EB6" link="#6633CC" alink="#6633CC" vlink="#6633CC">

<?php

$id_borrar
$_GET['accion'];
print(
"$id_borrar------------------------<br>");
$id$_GET['id'];
print(
"$id---------1");

$pag=$_SERVER['PHP_SELF'];  // el nombre y ruta de esta misma página.

$db=mysql_pconnect('localhost','root','');

if (!
$db){
    
    print (
"No se ha podido abrir la base de datos,por favor prueba mas tarde.<br>/n");
        
    }
    
    
mysql_select_db('clientesprueba');


$query"select * from gases";
    
    
$result=mysql_query($query);
        
    
$k=0;    

while (
$Row=mysql_fetch_array($result)) {
                
    
$Gases[]=$Row[NomGas];  /*nombre gas*/
    
$IdGas4[]=$Row[IdGas4];
    
$k++;

     }
    
    
    

/*------------Buscamos el precio----------------*/


mysql_select_db('datos');

for (
$i=0;$i<$k;$i++) {
    
    
$IdGas=$IdGas4[$i];
    

    
$IdGas=trim($IdGas);
    
$Id=$IdGas;

$query"select * from egas where Idgaspre=$IdGas";


$result=mysql_query($query);
$num_results=mysql_num_rows($result);
$Row=mysql_fetch_array($result);

 
$Precio[]=$Row[Precio];


}    


/*-----------------------Imprimimos todo-----------------------*/
print ("<br>");
print (
" <font color=#FFFFFF size=5><b><center>.:Eliminar Precio:.</center></b></font>");

print (
"<br><br>");
print (
"<table border=1 cellspacing=0 cellpadding=4 bordercolor=#CCCCCC align=center>");
print (
" <tr bgcolor=#00CCCC><td><font color=#FFFFFF><b><center>Nombre Gas</center></b></font></td><td><font color=#FFFFFF><b><center>Precio Gas</center></b></font></td><td><font color=#FFFFFF><b><center><br></center></b></font></td></tr>");

for (
$i=0;$i<$k;$i++) {
    
    
$Id=$IdGas4[$i];

if(
$Precio[$i]){        
if (
$Gases[$i]) {
    
print (
"<tr><td bgcolor=#FFFFEA>$Gases[$i]</td>");

} else { print (
"<td bgcolor=#FFFFEA><br></td>");}


if (
$Precio[$i]) {
    
print (
"<td bgcolor=#FFFFEA>$Precio[$i] &euro;uros</td>");

} else { print (
"<td bgcolor=#FFFFEA><br></td>");}

if(
$Precio[$i]){
    
    

print (
"<td bgcolor=#FFCC99><center><a href=\"javascript:confirmar('".$Id."')\">Borrar</a></center></td></tr>");

}else{  print (
"<td bgcolor=#FFCC99><br></td>");}

}
}
/*for*/

print("</table>");


if (
$id_borrar==borrar){
    
    print(
"esto si me lo hace el resto no :(");
    
if (
$id){
    

mysql_select_db('datos');
    

$egas="egas";
$id_borrar=$id;
mysql_query("DELETE FROM $egas WHERE Idgaspre=$id_borrar");

header ("Location: $pag");
exit;

}

}else{ print(
"esto tambien me lo hace bien me falta el id del gas");

}
?>

</body>

</html>

Muchisimas gracias a todos.