如何在php中循环更新查询并显示它,就像日志历史一样

<?php
include('core/init.php');//database connection


if(isset($_POST['btn_submit'])){
   $sqlQuery = mysql_query("UPDATE `position` SET `ATR`='".mysql_real_escape_string($_POST['ATR'])."', 
  $resultQuery = mysql_query($connection, $sqlQuery) or die (mysql_error($connection));

  if(mysql_affected_rows($resultQuery) > 0){
  echo "updated";
 }else{
  echo "failed";
 }
  header('Location:position2.php');
   $result = mysql_query("SELECT * FROM position WHERE ID='" .$_POST["id"]. "'");
   $row2 = mysql_fetch_array($result);
 }
 ?>

//What this code does it it updates the database based on user input and I am trying to loop through each of the user input as update and display but it doesn't seem to work

($_POST['ATR'])."', Is missing a closing " Also formatting code makes it easier to read and debug.