Backup database network error

This is my code and I don’t know what is happening because when I click my button to backup my database, It is downloading but it is failed network error, but when I click resume It is download but it is .php not ,sql . I need ,sql, thankyou in advance

<?php
ob_start();

  $connect = new PDO("mysql:host=localhost;dbname=i******", "********", "*****");
  $get_all_table_query = "SHOW TABLES";
  $statement = $connect->prepare($get_all_table_query);
  $statement->execute();
  $result = $statement->fetchAll();

    if(isset($_POST['table'])) {

        $output = '';

          foreach($_POST["table"] as $table) {

              $show_table_query = "SHOW CREATE TABLE " . $table . "";
              $statement = $connect->prepare($show_table_query);
              $statement->execute();
              $show_table_result = $statement->fetchAll();

              foreach($show_table_result as $show_table_row) {
                  $output .= "\n\n" . $show_table_row["Create Table"] . ";\n\n";
              }
                  $select_query = "SELECT * FROM " . $table . "";
                  $statement = $connect->prepare($select_query);
                  $statement->execute();
                  $total_row = $statement->rowCount();

              for($count=0; $count<$total_row; $count++) {
                  $single_result = $statement->fetch(PDO::FETCH_ASSOC);
                  $table_column_array = array_keys($single_result);
                  $table_value_array = array_values($single_result);
                  $output .= "\nINSERT INTO $table (";
                  $output .= "" . implode(", ", $table_column_array) . ") VALUES (";
                  $output .= "'" . implode("','", $table_value_array) . "');\n";
              }
          }

    $file_name = $table . '.sql';
    $file_handle = fopen($file_name, 'w+');
    fwrite($file_handle, $output);
    fclose($file_handle);
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename=' . basename($file_name));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file_name));
    ob_clean();
    flush();
    readfile($file_name);
    unlink($file_name);
}

include '../dbconnect.php' ;


	session_start();
	$xID = $_SESSION['userId'];
   
  $sql = "SELECT * FROM info WHERE logid ='$xID'";
  
  $res = $conx->query($sql);
	$row = $res->fetch_array() 

?>

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title> DENTADERM </title>
	<!-- Tell the browser to be responsive to screen width -->
		<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
	<!-- Bootstrap 3.3.7 -->
		<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css">
  <!-- Font Awesome -->
		<link rel="stylesheet" href="../bower_components/font-awesome/css/font-awesome.min.css">
  <!-- Ionicons -->
		<link rel="stylesheet" href="../bower_components/Ionicons/css/ionicons.min.css">
  <!-- DataTables -->
		<link rel="stylesheet" href="../bower_components/Ionicons/css/ionicons.min.css">
  <!-- jvectormap -->
		<link rel="stylesheet" href="../bower_components/jvectormap/jquery-jvectormap.css">
  <!-- Theme style -->
		<link rel="stylesheet" href="../dist/css/AdminLTE.min.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
		<link rel="stylesheet" href="../dist/css/skins/skin-blue.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
	<link rel="stylesheet"
		href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
</head>
<body class="hold-transition skin-blue sidebar-mini">
  <div class="wrapper">

   
   <body class="hold-transition skin-blue sidebar-mini">
      <header class="main-header">

    <!-- Logo -->
      <a href="#" class="logo">
    <!-- logo for regular state and mobile devices -->
      <span class="logo-lg"><b>DENTA</b>DERM</span>
      </a>
      
      <!-- Header Navbar: style can be found in header.less -->
      <nav class="navbar navbar-static-top">
    <!-- Sidebar toggle button-->
      <a href="" class="sidebar-toggle" data-toggle="push-menu" role="button">
        <span class="sr-only">Toggle navigation</span>
      </a>
      
      <!-- Navbar Right Menu -->
      <div class="navbar-custom-menu">
      <ul class="nav navbar-nav">

    <!-- User Account: style can be found in dropdown.less -->
          <li class="dropdown user user-menu">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown">
          <img src="../admin/img/<?php echo  $row['Profile'] ; ?>" class="user-image" />
            <span class="hidden-xs"> <?php echo  $row['Fname']. " ". $row['Lname']; ?>   </span>
              </a>
          <ul class="dropdown-menu">
            
      <!-- User image -->
          <li class="user-header">
              <img src="../admin/img/<?php echo  $row['Profile'] ; ?>" class="img-circle" alt="User Image">
                  <p>
                    <?php echo  $row['Fname']. " ".  $row['Lname']; ?> - Admin
                    <small> Member Since: <?php echo  $row['Creation'] ?>  </small>
                  </p>
          </li>
             
    <!-- Menu Footer-->
        <li class="user-footer">
            <div class="pull-left">
                <a href="../admin/adprofile/adprofile.php" class="btn btn-default btn-flat">Profile</a>
            </div>
                <div class="pull-right">
                <a href="../logout.php" class="btn btn-default btn-flat">Sign out</a>
            </div>
        </li>  
        </ul>
        </nav>
        
 </header>

	<!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
    <!-- Sidebar user panel -->
    <div class="user-panel">
      <div class="pull-left image">
        <img src="../admin/img/<?php echo  $row['Profile'] ; ?>" class="circle" alt="User Image"> 
        </div>
      <div class="pull-left info">
  <p> <?php echo  $row['Fname']. " ". $row['Lname'];  ?>  </p>
          <i class="fa fa-circle text-success"></i> Online</a>
      </div>
      </div>
    
    <!-- sidebar menu: : style can be found in sidebar.less -->
    <ul class="sidebar-menu" data-widget="tree">
      <li class="header">MAIN NAVIGATION </br> </br></li>
  
    <li>
      <a href="../admin/homeadmin.php">
        <i class="fa fa-dashboard "></i> <span> Home</span>
      </a>
        </li>
				
		
				<li class="active treeview menu-open">
					<a href="">
						<i class="fa fa-user"> </i> <span> User Profile </span>
							<span class="pull-right-container">
								<i class="fa fa-angle-left pull-right"></i>
							</span>
					
        <ul class="treeview-menu">
            <li><a href="../admin/adprofile/adprofile.php"><i class="fa fa-circle-o"></i>  Profile </a></li>
				<li><a href="changepassword/changepas.php"><i class="fa fa-circle-o"></i> Change Password </a></li>
        </ul>
			</li>
				
		

      <li>
      <a href="block.php">
        <i class="fa fa-warning"></i> <span> User/s Block </span>
      </a>
        </li>
		
		<li>
			<a href="reset.php">
				<i class="fa fa-unlock"></i> <span> Reset Password </span>
			</a>
        </li>
		
		<li>
      <a href="assign.php">
        <i class="fa fa-user-plus "></i> <span> Register </span>
      </a>
        </li>
		
		
		<li>
			<a href="backup.php">
				<i class="fa fa-exchange "></i> <span> Backup </span>
			</a>
        </li>
		
        
		

	
		<li><a href="view.php"><i class="fa fa-eye"></i> <span> View appointments </span> 
        <span class="pull-right-container">
            
            </span>
      </a>
        </li>
		

      <li><a href="done.php"><i class="fa fa-check"></i> <span> Done appointments </span> 
        <span class="pull-right-container">
            
            </span>
      </a>
        </li>
		
	<li>
      <a href="records.php">
        <i class="fa fa-folder-open-o"></i> <span> Records </span>
      </a>
        </li>
	

    <li>
      <a href="adhelp.php">
        <i class="fa fa-question"></i> <span> Help </span>
      </a>
        </li>
		
         </ul>
		</aside>
    <!-- /.sidebar -->


    <!-- Content Header (Page header) -->
         <div class="content-wrapper">
      <!-- Main content -->
         <section class="content">

          <!-- row -->
          <div class="row">
            <div class="col-md-12">
              <!-- The time line -->
              <ul class="timeline">
                <!-- timeline time label -->
                <li class="time-label">
                      <i class="fa fa-gears (alias) bg-blue"></i>
                     <div class="timeline-item">
                        <ol class="breadcrumb">
                          <li><a href="../admin/homeadmin.php"><i class="fa fa-dashboard"></i> Home</a></li>
                          <li><a href="./adprofile/adprofile.php"> Profile</a></li>
                          <li><a href="block.php"> User/s Block </a></li>
                          <li><a href="reset.php"> Reset Password </a></li>
                          <li><a href="assign.php"> Register </a></li>
						  <li><a href="backup.php"> Backup </a></li>
						  <li><a href="view.php"> View appointment </a></li>
						  <li><a href="done.php"> Done appointment </a></li>
						  <li><a href="records.php"> Record </a></li>
                          <li><a href="adhelp.php"> Help </a></li>
                      </ol>
                  </div>
                </li>
         <!-- END HEADER-->

   
        <li>
              <i class="fa fa-exchange bg-green"></i>
        <div class="timeline-item">
           <h3 class="timeline-header"><b style="color:blue;"> Backup </b>  </h3>
            <div class="timeline-body">

                
             <form method="post" id="export_form">
                <h3>Select Tables for Export</h3>
                  <?php foreach($result as $table) { ?>

              <div class="checkbox">
                <label><input type="checkbox" class="checkbox_table" name="table[]" value="<?php echo $table[0]; ?>" /> <?php echo $table[0]; ?></label>
              </div>

    <?php }  ob_end_flush(); ?>

              <div class="form-group">
                  <input type="submit" name="submit" id="submit" class="btn btn-success" value="Export" />&nbsp; 
                    
              </div>
                    </form>
          
          
          
<!-------------------------------------------- Restore ----------------------------------->



        <li>
              <i class="fa fa-exchange bg-green"></i>
        <div class="timeline-item">
           <h3 class="timeline-header"><b style="color:blue;"> Restore </b>  </h3>
            <div class="timeline-body">

                
             <?php
        if(isset($_SESSION['error'])){
          ?>
          <div class="alert alert-danger text-center">
            <?php echo $_SESSION['error']; ?>
          </div>
          <?php

          unset($_SESSION['error']);
        }

        if(isset($_SESSION['success'])){
          ?>
          <div class="alert alert-success text-center">
            <?php echo $_SESSION['success']; ?>
          </div>
          <?php

          unset($_SESSION['success']);
        }
      ?>
        
          <form method="POST" action="restore.php" enctype="multipart/form-data">
           
              
              <div class="form-group row">
                  <label for="sql" class="col-sm-3 col-form-label">File</label>
                  <div class="col-sm-9">
                    <input type="file" class="form-control-file" id="sql" name="sql" placeholder="table you want to restore to" required>
                  </div>
              </div>
              <button type="submit" class="btn btn-success" name="restore">Restore</button>
          </form>
        </div>
          
          

         </div>  
        </li>



    <!-- END Home -->
            <li>
              <a href="#" class="btn btn-primary btn-md" role="button"> <i class="fa fa-arrow-up"> </i> Up </a>
            </li>
          </ul>
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
  
  </section>
    </div>


    <footer class="main-footer">
        <div class="pull-right hidden-xs">
           <a href="https://facebook.com/Dentadermclinic" class="btn btn-social-icon btn-facebook"><i class="fa fa-facebook"></i></a>       
                <a href="https://instagram.com/Dentadermclinic" class="btn btn-social-icon btn-instagram"><i class="fa fa-instagram"></i></a>
                <a href="https://twitter.com/Dentadermclinic" class="btn btn-social-icon btn-twitter"><i class="fa fa-twitter"></i></a>
        </div>
        <strong>Copyright &copy; 2014-2016 <a href="#"> Dentaderm Clinic </a>.</strong> All rights
    reserved.
  </footer>



<!-- jQuery 3 -->
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- FastClick -->
<script src="../bower_components/fastclick/lib/fastclick.js"></script>
<!-- DataTables -->
<script src="../bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="../bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="../bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="../bower_components/fastclick/lib/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- page script -->
</body>
</html>

<script>
$(document).ready(function(){
  $('#submit').click(function(){
    var count = 0;
  $('.checkbox_table').each(function(){
    if($(this).is(':checked')) {
      count = count + 1;
    }
  });
  if(count > 0) {
    $('#export_form').submit();
  } else {
    alert("Please Select Atleast one table for Export");
    return false;
  }
  });
  $('#checkAll').on('click',function() {
    $('input:checkbox').prop('checked', this.checked);
  });
});
</script>

I’ve moved this to the correct category for you.

As you’ve not been entirely clear can you explain what you need to do? (You chose 000webhost Services)
So I can only assume you are trying to backup/download a database from 000WEBHOST.

Head to Manage Database > Manage > phpMyAdmin, it will log you in - then hit export and download your database.

If you need assistance with something else then explain in better detail and more community members may reply.

http://stackoverflow.com is a great aid if code related.