<body>
<center>
<h2>PHP+MySQL 例子</h2>
<h3><u><font color=brown>请在文本区域输入数据并且确定 </font></u></h3>
<form action="<? echo $PHP_SELF?>" method=POST>
<textarea cols=40 rows=5 name=txt></textarea>
<br>
<input type="submit" value="确定">
</form>
<?
$connect_id=mysql_connect("localhost","username","password");
if(isset($txt)) {
$dbtime=date("Y-m-d H:i:s");
mysql_db_query("usernamedb","insert into test values (0,'$dbtime','$txt')");
}
?>
<p>
</center>
<div align=center><center>
<table border=1 cellpadding=0 cellspacing=2 width=80%>
<tr><td>
<?
$result=mysql_db_query("usernamedb","select * from test");
while($userdb=mysql_fetch_row($result))
{
echo "<".$userdb[0].">: <font color=purple>".$userdb[1]."</font> <font color=red>".$userdb[2]."</font><br>n";
}
mysql_close($connect_id);
?>
</td></tr>
</table>
<p>
</body>
</html>
文章来源于领测软件测试网 https://www.ltesting.net/
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073