Cloud Stack Ninja

In table documentos are the documents stored and in table categorias are the subfolders, first I make a table to see if there are documents, then I consult table g to find out what the subfolders are. I save the result of that query in an array, with a for loop I go through the array to build the path and make the copy from folder documentos to folder copia_seguridad, the error failed to open stream is displayed.


if (!empty($_GET['copia']) ){
    $consultar1 = mysqli_query($conexion,"SELECT * FROM documentos" );
    $total = mysqli_num_rows($consultar1);
    if($total > 0){
        if (!file_exists("copia_seguridad")) {
        while ( $doct = mysqli_fetch_row($consultar1)){
            $consultar_categoria = mysqli_query($conexion,"SELECT nombreCategoria FROM categorias");
            $subdirectory = mysqli_fetch_array($consultar_categoria);
            $longitud = count($subdirectory);
            for($i=0; $i<$longitud; $i++){
        echo  "<script> alert('Copia de Seguridad realizada...'); </script>";
        echo "<script>document.location.href = 'admin.php'; </script>";
        echo  "<script> alert('No hay documentos para guardar...'); </script>";
        echo "<script>document.location.href = 'admin.php'; </script>";


I tried to change the for to a foreach but the error was displayed again.

Read more here:

Content Attribution

This content was originally published by Ives Andrey Rodriguez Acelas at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: