my problem it's I'm trying to develop a back-end where I need to update but my problem is, when I update one field my script update all fields and all data of my mysqli database.
My code for now is: 
<html>
<body>
<?php
  ini_set('display_errors', 1);
   error_reporting(~0);
   $serverName = "localhost";
   $userName = "root";
   $userPassword = "";
   $dbName = "hotel_vaniet";
   $strCustomerID = null;
   if(isset($_GET["cod"]))
   {
       $cod = $_GET["cod"];
   }
   $serverName = "localhost";
   $userName = "root";
   $userPassword = "";
   $dbName = "hotel_vaniet";
   $conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
   $sql = "SELECT * FROM quartos WHERE cod=$cod";
   $query = mysqli_query($conn,$sql);
   $result=mysqli_fetch_array($query,MYSQLI_ASSOC);
?>
<div id="main">
<form action="editar_quartos_final.php" name="frmAdd" method="post">
<br><h1>Página de Edição</h1>
<br><hr/>
<div id="login2">
<table width="284" border="1">
  <tr>
    <th width="120">Tipo</th>
    <td width="238"><input type="text" name="tipo" size="50" value="<?php echo $result["tipo"];?>"></td>
    </tr>
  <tr>
    <th width="120">Capacidade</th>
    <td><input type="text" name="capacidade" size="50" value="<?php echo $result["capacidade"];?>"></td>
    </tr>
  <tr>
    <th width="120">Preço p/ Noite</th>
    <td><input type="text" name="preco" size="50" value="<?php echo $result["preco"];?>"></td>
    </tr>
  <tr>
    <th width="120">Reservado</th>
    <td><input type="text" name="reservado" size="50" value="<?php echo $result["reservado"];?>"></td>
    </tr>
  </table>
  <br><input id="submitbuttoneditar" type="submit" value=" Editar " name="submit"/><br />
  </div>
</form>
<?php
mysqli_close($conn);
?>
</body>
</html>
This the first page ,this page send me to another where makes all changes. The second page :
<html>
<head>
<title>Página de Edição do Cliente</title>
</head>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "hotel_vaniet";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
$sql = "UPDATE quartos SET 
            tipo = '".$_POST["tipo"]."' ,
            capacidade = '".$_POST["capacidade"]."' ,
            preco = '".$_POST["preco"]."' ,
            reservado = '".$_POST["reservado"]."'
            WHERE cod=cod";
if ($conn->query($sql) === TRUE) {
    echo "Dados actualizados com sucesso!";
    header("Location: quartos.php");
} else {
    echo "Erro na edição dos dados! " . $conn->error;
    header("Location: quartos.php");
}
$conn->close();
?>
</body>
</html> 
 
     
     
    