Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/12/2007, 19:37
Avatar de petoko
petoko
 
Fecha de Ingreso: noviembre-2007
Ubicación: talcahuano chile
Mensajes: 173
Antigüedad: 16 años, 5 meses
Puntos: 0
alguen me puede decir cual es mi error ?

hola amigos tengo un codigo php para hacer respaldo de una base de datos pero no lo hace y no se la razon me pueden dar una mano con esto aqui va el codigo

Código PHP:
<?php
    
function Connect($host,$user,$passwd)
     {  
      if(!(
$link=mysql_connect($host,$user,$passwd)))
       {
        echo 
"Error connecting to DDBB.";
        exit();
       }
       return 
$link;
     }
$link=Connect('localhost','geko','');
//
if($_POST['submit'])
 { 
     
$db=$_POST['db'];
    
     echo 
"aka$db <br>";
  
  
     
$output=shell_exec("C:\AppServ\MySQL\bin\mysqldump.exe -u geko -proot ".$db); // ejemplo windows


    //$output=shell_exec("/usr/bin/mysqldump -u root -proot ".$db); // ejemplo linux
    //
    
if(trim($output)==NULL)
     {
         echo 
"Error creando el backup de la DB: ".$db;
         exit();
     }
    
header('Content-type: text/plain');
    
header('Content-Disposition: attachment; filename="'.$db.'.sql"');
    echo 
$output;
    exit();
 }    
$select="show databases";
$select=mysql_query($select); 
?>
<html>
<head>
</head>
<body>
 <form action="" method="post">  
  <select name="db">
  <?php
  
while($row mysql_fetch_row($select))
   {
       
?>
       <option value="<?php echo $row[0]; ?>"><?php echo $row[0]; ?></option>
       <?php
   
}    
  
?>
  </select>
  <input type="submit" name="submit" value="Crear backup" />  
 </form>
</body>
</html>
me manda todo el rato a
echo "Error creando el backup de la DB: ".$db;

no se por que me pueden decir cual es mi error por favor