Ver Mensaje Individual
  #7 (permalink)  
Antiguo 17/08/2010, 03:00
fixios
 
Fecha de Ingreso: agosto-2010
Mensajes: 17
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: Problema al borrar un registro de una tabla

Lo acabo de poner y se me ha liado todo, ahora me sale de error lo siguiente:

-------------------------------------------------------------------------------------------------------
Notice: Undefined variable: var in C:\wamp\www\Administrador\IP\ip.php on line 89

Notice: Undefined variable: var in C:\wamp\www\Administrador\IP\ip.php on line 92

Notice: Undefined variable: var in C:\wamp\www\Administrador\IP\ip.php on line 95

Notice: Undefined variable: var in C:\wamp\www\Administrador\IP\ip.php on line 98

Notice: Undefined variable: var in C:\wamp\www\Administrador\IP\ip.php on line 101

Notice: Undefined variable: var in C:\wamp\www\Administrador\IP\ip.php on line 104
--------------------------------------------------------------------------------------------------------
El codigo de ip.php es el siguiente:

<?php
include("seguridad.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sniace - Administrador</title>
<link href="../../estilos.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function pregunta(valor,valor1)
{
if(confirm("¿Esta seguro que desea borrarlo?"))
document.location.href="borraip.php?id="+valor+"&i ="+valor1;
else
document.location.href="";
}
</script>
</head>
<body>
<table id="tablaprinc" align="center" width="862" height="364" border="0">
<tr>
<td width="95%" height="86"><div align="left">
<table align="center" width="631" border="0">
<tr>
<td><img src="../../img/sniace.jpg" width="209" height="82" alt="sniace" /></td>
<td><img src="../../img/image(2).png" alt="Inet" width="377" height="71" /></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td width="95%" height="43"><table width="99%" height="34" border="0">
<tr>
<td width="95%" height="43"><table width="99%" height="34" border="0">
<tr>
<td width="20%" id="menus"><a href="../Incidencias/administrarincidencias.php">Incidencias</a></td>
<td width="20%" align="left" id="menus"><a href="../Noticias/administranoticia.php">Noticias</a></td>
<td width="20%" id="menus"><a href="../extensiones/extensiones.php">Extensiones</a></td>
<td width="20%" id="menus"><a href="../Numeros/numeros.php">M&oacute;viles</a></td>
<td width="20%" align="left" id="menus"><a href="../correo/correo.php">Correo</a></td>
</tr>
</table> </td>
</tr>
</table> </td>
</tr>
<tr>
<td><table width="99%" height="34" border="0">
<tr>
<td width="20%"></td>
<td width="20%"></td>
<td width="20%" id="menus"><a href="../ip/administrarip.php">IP</a></td>
<td width="20%"></td>
<td width="20%"></td>
</tr>
</table></td>
</tr>
<tr>
<td width="95%" height="180">
<p id="incidencia" >Administraci&oacute;n de Direcciones IP</p>
<table align="right" width="15%" border="0">
<tr>
<?php
if (isset($_GET["i"]))
{
$var=$_GET["i"];
}
echo '
<td id="panelc"><a href="informe.php?i='.$var.'"><div align="center">
<p><img src="../../img/plantillas_de_factura.png" alt="informe" width="128" height="128" border=0/>
Tabla de Direcciones</p>
</div></a></td>';
?>
</tr>
</table>
<p></p>
<p>
<?php
//conexion a la base de datos

include("conexion1.php");
$link=Conectarse();

if (isset($_GET["i"]))
{
$var=$_GET["i"];
}

if($var==0){
$nombre="direccionesip0";
}
if($var==1){
$nombre="direccionesip1";
}
if($var==2){
$nombre="direccionesip2";
}
if($var==4){
$nombre="direccionesip4";
}
if($var==5){
$nombre="direccionesip5";
}
if($var==10){
$nombre="direccionesip10";
}

/******** INSERT CON PROCEDIMIENTO ALMACENADO **********/
$sql="SELECT * FROM $nombre";
$var1=1;
$result = mysql_query($sql,$link);


$link=Conectarse();
// $nombre procede de index.php y contiene la tabla seleccionada por el usuario en una lista desplegable.
//Es imprescindible pasarlo como variable en los enlaces de paginacion

$colorfila=0;

echo "<table border=1 align='center'>";
echo"<tr align=center>";
$color= "#D3DCE3";

if (mysql_num_rows($result)> 0) {
echo "<td bgcolor=".$color.'><a href="ip.php?i='.$var.'">IP</a></td>';
echo "<td bgcolor=".$color.'><a href="ip.php?a=1&i='.$var.'">Nombre</a></td>';
echo "<td bgcolor=".$color.">Accion</td>";
}
if (isset($_GET["a"])){
$result2 = mysql_query("SELECT * FROM $nombre WHERE Nombre NOT LIKE '' ORDER BY $nombre.Nombre ASC;",$link);
}
else{
$result2 = mysql_query("SELECT * FROM $nombre ORDER BY $nombre.ID ASC;",$link);
}
while ($row2 = mysql_fetch_array($result2, MYSQL_NUM)) {
if ($colorfila==0){
$color= "#F5F5F5";
$colorfila=1;
}else{
$color="#D5D5D5";
$colorfila=0;
}
echo "<tr align=center>";
if ($row2[3]==1)
{
echo "<td bgcolor='".$color."'><font color=red><b>".$row2[1]."</b></font></td>";
echo "<td bgcolor='".$color."'><font color=red><b>".$row2[2]."</b></font></td>";
}
else{
echo "<td bgcolor='".$color."'>",$row2[1],"</td>";
echo "<td bgcolor='".$color."'>",$row2[2],"</td>";
}
$var=$_GET["i"];
echo "<td align=center bgcolor='".$color."'",'><a href="editaip.php?id='.$row2[0].'&nom='.$row2[2].'&ip='.$row2[1].'&i='.$var.'"><img src="../../img/edit.png" width="25" height="25" border=0/></a>';
echo '<a href="borraip.php?&id='.$row2[0].'&i=var"><img src="../../img/delete.png" alt="delete" width="25" height="25" onClick="pregunta('.$row2[0].','.$var.');" border=0/></a></td>';


echo "</tr>";
}
echo "</table>";
?>
</p>
<p><br />
<br />
</p>
</p></td>
</tr>
<tr>
<td>
<table align="center" width="23%" border="0">
<tr>
<td id="panelc"><a href="administrarip.php"><img src="../../img/volver.png" alt="volver" width="187" height="83" border="0" /></a></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<p align="right"><a href="../../login.php"><img src="../../img/apagar.png" alt="logout" width="30" height="30" border="0" /></a></p></td>
</tr>
</table>
</table>
</body>
</html>
--------------------------------------------------------------------------------------------------------

Creo que el error esta en la siguiente expresion:

<?php
if (isset($_GET["i"]))
{
$var=$_GET["i"];
}
echo '

pero no se me ocurre como arreglarlo.