关于服务器提交和响应的问题
我这里有一个例子 我是新手 初学来着
我每次第一次提交数据库表会更新 表格里面则不会 需要第二次提交表格里面才会出现数据库的最新数据
我应该怎么解决呢?
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
<html>
<head>
<title>connect db</title>
</head>
<body>
<form action="/aaa.php" method="post">
<table border=1>
<?php
$link=mysql_connect("localhost","root","");
mysql_select_db("s");
$result=mysql_query("select Name from stud");
for($a=0;$a<3;$a++)
{
echo "<tr>";
for($b=0;$b<3;$b++)
{
$c="LL".$a.$b;
if($l=mysql_fetch_array($result,MYSQL_NUM))
{
$$c=$l[0];
echo "<td><input type=\"text\" name=\"lll".$a.$b."\" value=".$$c."></td>";
}
else
{
$$c="";
echo "<td><input type=\"text\" name=\"lll".$a.$b."\" value=".$$c."></td>";
}
}
echo "</tr>";
}
?>
</table>
<input type="text" name="Name">
<input type="text" name="Age">
<input type="submit" name="submit1" value="tj">
<?php
if($_POST["Name"]!="" and $_POST["Age"]!="")
{
mysql_query("insert into stud select last_insert_id(),'".$_POST["Name"]."',".(int)$_POST["Age"]);
for($a=0;$a<3;$a++)
{
for($b=0;$b<3;$b++)
{
$c="LL".$a.$b;
if($l=mysql_fetch_array($result,MYSQL_NUM))
{
$$c=$l[0];
}
else
{
$$c="";
}
}
}
}
else
{
print "格式不正确";
}
?>
</form>
</body>
</html>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号