title: When i inserting data into mysql it insert two datas, and i dont know why
body: <p>When i inserting using this code it insert two datas and i downt know how to fix it</p>
  
  <pre><code>$sql = "SELECT Version_id FROM versions ORDER BY Version_id DESC LIMIT 1;";
  $result = $conn-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) {
      // output data of each row
      while($row = $result-&gt;fetch_assoc()) {
          $lastVersion =$row["Version_id"];
      }
  }
  echo($lastVersion);
  $lastVersion++;
   $sql = "INSERT INTO versions (version)
  VALUES ('v$lastVersion')";
  if (mysqli_query($conn, $sql)) {
       echo "New record created successfully";
  } else {
      echo "Error: " . $sql . "&lt;br&gt;" . mysqli_error($conn);
  }
  </code></pre>