<?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);
}
?>
//这段代码的作用是根据用户输入更新数据库,我试图循环浏览每个用户输入作为更新和显示,但它似乎无法正常工作
答案 0 :(得分:1)
($ _ POST [ 'ATR'])。“”, 缺少结束“ 格式化代码也使其更易于阅读和调试。