Ver Mensaje Individual
  #4 (permalink)  
Antiguo 18/10/2012, 15:06
edward_bukowski_1980
 
Fecha de Ingreso: octubre-2012
Ubicación: Caracas, Venezuela
Mensajes: 31
Antigüedad: 11 años, 6 meses
Puntos: 0
Respuesta: Problema de undefined index.

Si hago esto, cambiar mis variables sql de orden, me da este error.

Código PHP:
<?php 



$id 
$_GET['id'];


 require (
"funciones4.php");

$idc conectar();


$sql="SELECT * FROM musica2 m, generos g WHERE m.id = g.id";
if(!
mysql_query($sql)) echo mysql_error(); 

$sql="DELETE generos FROM generos, musica2 WHERE generos.id = musica2.id";


$res ejecutar($sql,$idc);
$fila getRegistro ($res);




$sql "select *from musica2 where id=$id";


if(!
mysql_query($sql)) echo mysql_error(); 

$sql "delete from musica2 where id=$id";


$res ejecutar($sql,$idc);












?>
<!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=utf-8" />
<title>Sistema</title>
<link href="estilo_eliminar.css" rel="stylesheet" type="text/css" />
</head>
<body>


   <?php 
if ($res)
    echo 
"ELIMINACIÓN EXITOSA";
else
    echo 
"ERROR";
?>

 
<br/>
<br/>
<table width="330" border="10" >
 
  <tr>
    <td width="113" align="center">Álbum:</td>
    <td width="183" align="center"><?php echo $fila['album'];?></td>
  </tr>
  <tr>
    <td align="center">Artista:</td>
    <td align="center"><?php echo $fila['artista'];?></td>
  </tr>
  <tr>
    <td align="center">Canciones:</td>
    <td align="center"><?php echo $fila['canciones'];?></td>
  </tr>
  <tr>
    <td align="center">Géneros:</td>
    <td align="center"><?php echo $fila['genero1'];?><?php echo " " ?>

    <?php echo $fila['genero2'];?><?php echo " " ?>
   
    <?php echo $fila['genero3'];?><?php echo " " ?>
  
    
    
    
    </td>
  </tr>
  <tr>
    <td align="center">Año:</td>
    <td align="center"><?php echo $fila['ano'];?></td>
  </tr>  
  <tr>  
    <td align="center">Imagen:</td>
    <td align="center"><?php echo $fila['imagen'];?></td> 
  </tr>
</table>
</body>
</html>
<?php 
cerrar 
($idc);
?>

Error.

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\Sistema_Edward-Bukowski\funciones4.php on line 22

Código PHP:
<?php
function conectar() {
    
$idc mysql_connect ("localhost""root""");
    if (!
$idc)
        die (
"Error en la conexion al MYSQL");
    if (!
mysql_select_db ("bd_prueba3"$idc))
        die(
"Error en la seleccion de la BD");
        
mysql_query ("SET NAMES 'utf8'");
        return 
$idc;
    
    }

function 
ejecutar ($sql,$idc){
    return 
mysql_query($sql,$idc);
    }

function 
totalRegistros ($res){
    return 
mysql_num_rows ($res);
    }
    
function 
getRegistro ($res){
    return 
mysql_fetch_array ($res);
    }



function 
cerrar ($idc){
    
mysql_close($idc);
    }


?>
Por favor como puedo solucionar este problema.
Saludos.